Under construction

Still being built. Things may change

When Do We Finish?

Interview

Time limit1sMemory limit128 MB

Summary
Add each event's duration to its start time and print the resulting clock time, appending the number of days past midnight when the end crosses into later days.
Level

Easy3 of 10

Topics
Math, Implementation, Simulation, Brute force
Solved
No attempts yet

Problem

You are given the starting time of an event and its duration. Determine the time at which the event ends.

Input

The input consists of several lines, each representing one event. The last line is 00:00 00:00 and must not be processed.

Each line contains two times separated by a space, both in hh:mm format. The first time is the event's start time, given as a valid 24-hour clock time. The second time is the duration: its minutes range from 0 to 59 inclusive, and its hours range from 0 to 96 inclusive.

Output

For each input line, print on one line the time at which the event ends, as a valid 24-hour time in hh:mm format. If this time is not on the same day as the start time, print it in the format hh:mm +n, where n is the number of days after the starting day.

Examples2

  1. Example 1

    Input
    03:50 06:10
    15:25 26:30
    23:59 00:01
    00:00 00:00
    
    Expected output
    10:00
    17:55 +1
    00:00 +1
    
  2. Example 2

    Input
    01:00 00:30
    22:00 03:00
    00:00 00:00
    
    Expected output
    01:30
    01:00 +1