Under construction

Still being built. Things may change

Where Is My Package

Time limit1sMemory limit1024 MB

Summary
Given the shift start and end times, the count of earlier packages, and the minutes per delivery, find the day offset and clock time when Bsil's package arrives.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

Bsil ordered something online. What was it that made Bsil so excited since morning? Now it is evening and the courier's end-of-shift time has come, yet the package has not arrived, so Bsil is crying.

On a delivery day, a text arrives in the morning with the estimated arrival time and the number of packages the courier must deliver to other houses before Bsil's.

The estimated arrival time is only an estimate, so the package does not necessarily arrive at that time. If we knew how long one delivery takes, could we work out when Bsil's package will arrive?

The courier starts delivering as soon as the shift begins. If the delivery in progress would finish at or after the end-of-shift time, the courier does not start it and goes home. For example, if the shift ends at 23:00, the current time is 22:50, and one delivery takes 10 minutes, the courier does not deliver and goes home, then starts again the next day.

Tell crying Bsil exactly when the package will arrive!

Input

The first line contains the courier's start time and end time in the format HH:MM, separated by a space. (0≤0 \le HH ≤23;\le 23; 0≤0 \le MM ≤59\le 59)

The second line contains the number of packages NN that must be delivered before Bsil's package, and the time TT one delivery takes, separated by a space. Time is measured in minutes. (0≤N≤10 000;0 \le N \le 10\,000; 1≤T≤601 \le T \le 60)

The start time is always earlier than the end time, and both times are on the same day. Also, no input has a delivery time TT that is longer than or equal to the courier's working time.

Output

The first line prints how many days later Bsil's package arrives.

The second line prints the arrival time in hours and minutes, in the same format as the input.

Examples2

  1. Example 1

    Input
    09:00 16:00
    3 15
    
    Expected output
    0
    10:00
    
  2. Example 2

    Input
    07:30 12:30
    100 42
    
    Expected output
    14
    09:36