Speedwriting

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Authors:
Problem type

So nicoella and AlanL got put together to create a problem. Since AlanL actually has a proper sleep schedule and doesn't sleep at 3 am Since AlanL likes to sleep, he sleeps earlier than nicoella does. However, this gives nicoella less time to discuss about the problem! And since they have to get the problem finished, she is debating whether she should start writing the problem, or wait for him to wake up to create his own idea to write the problem.

It is known that nicoella is very slow at writing problems, so it would be better if AlanL wrote the problem as they would both be able to finish earlier. Given the time that it takes for nicoella to write one problem, the time that it takes for AlanL to write one problem, the amount of time that he sleeps for, and the current time, print the earliest possible time for them to get the problem done.

Input Specification

The first line will contain N (1 \leq N \leq 1000), the amount of time in minutes it takes nicoella to think and write a problem, X (1 \leq X \leq 1000), the amount of time it takes for AlanL to write a problem, and Y (1 \leq Y \leq 500), the amount of minutes that he sleeps for before waking up to actually doing something productive.

The next line will be in the format HH:MM denoting the current time, in 24-hour clock time. H (0 \leq H \leq 23), M (0 \leq M \leq 59).

Output Specification

Output the time in which they will finish the problem, in HH:MM format, in 24-hour clock time.

Sample Input 1

10 3 6
12:05

Sample Output 1

12:14

Sample Input 2

3 1 5
23:59

Sample Output 2

00:02

Comments

There are no comments at the moment.