Marathoner
Time limit2sMemory limit1024 MB
Sum n song durations given as mm:ss and print the total run length in hh:mm:ss format.
- Level
Easy2 of 10
- Topics
- Implementation, String
- Solved
- No attempts yet
Problem
Baraš got into running. To keep it from getting boring, he listens to music while he runs.
Today Baraš forgot to start the stopwatch at the beginning of his run, so he does not know how long he ran. He did remember to turn on the music, though. He now wants to work out the length of the run from the songs he listened to.
During the run he listened to songs in full. For each song he wrote down its duration in mm:ss format. Exactly two digits come before the colon for minutes, and exactly two digits come after it for seconds. Each song is strictly shorter than an hour, and the minutes and seconds are between 0 and 59 inclusive.
Help Baraš find the duration of the run and print it in hh:mm:ss format: two digits for hours, then two for minutes, then two for seconds. The run is guaranteed to be strictly less than a day. Hours are between 0 and 23, and minutes and seconds are between 0 and 59.
Input
The first line contains one integer , the number of songs Baraš managed to listen to during the run (). Then lines follow, each in the form mm:ss, giving the duration of one song. All song durations are guaranteed to be positive.
Output
Print the duration of Baraš's run in hh:mm:ss format. It is guaranteed that the run lasted strictly less than a day.