Under construction

Still being built. Things may change

Jazz Enthusiast

Time limit2sMemory limit512 MB

Summary
Add up the lengths of n songs, subtract the crossfade time once for each pair of adjacent songs, and print the total as hh:mm:ss.
Level

Easy2 of 10

Topics
Math, Implementation, Simulation
Solved
No attempts yet

Problem

Kai is listening to his favourite jazz playlist. He likes to turn on crossfading between songs, so during the last seconds of a song, it will slowly fade out while the next one fades in. This happens between any two consecutive songs, but the beginning of the first song and the end of the last song will be played normally.

Determine the total amount of time it takes Kai to listen to the whole playlist.

Input

The input consists of:

  • Two integers n and c (1 ≤ n ≤ 100, 1 ≤ c ≤ 10), giving the number of songs and the crossfade time in seconds.
  • n lines of the form m:ss (0:30 ≤ m:ss ≤ 9:59), giving the song lengths (with one digit for the number of whole minutes and two digits for the remaining seconds).

Output

Output a string of the form hh:mm:ss, giving the total time it takes to listen through the whole playlist (with two digits for the number of whole hours, two digits for the number of remaining whole minutes, and two digits for the remaining seconds).

Examples2

  1. Example 1

    Input
    3 5
    3:59
    0:52
    9:40
    
    Expected output
    00:14:21
    
  2. Example 2

    Input
    1 10
    6:00
    
    Expected output
    00:06:00