Oven Clock

Interview

Time limit1sMemory limit128 MB

Summary
Given a start time and a number of minutes to cook, compute and print the finishing time on a 24-hour clock.
Level

Easy1 of 10

Topics
Math, Simulation
Solved
No attempts yet

Problem

An electronics company has made a smart oven that tells the user when cooking will finish. After the ingredients are placed in the oven and the cooking time is set, the oven calculates the finishing time in minutes.

Given the time when cooking starts and the number of minutes needed to cook, write a program that prints the time when cooking ends.

Input

The first line contains the current time: hour A and minute B, separated by a space. A is an integer from 0 to 23, and B is an integer from 0 to 59.

The second line contains C, the cooking time in minutes. C is an integer from 0 to 1,000.

Output

Print the hour and minute of the finishing time, separated by a space. The hour must be from 0 to 23, and the minute must be from 0 to 59.

On the digital clock, one minute after 23:59 is 0:00.

Examples3

  1. Example 1

    Input
    14 30
    20
    
    Expected output
    14 50
    
  2. Example 2

    Input
    17 40
    80
    
    Expected output
    19 0
    
  3. Example 3

    Input
    23 48
    25
    
    Expected output
    0 13