Login Register

Snooze

You are an avid user of the Snooze button on your alarm clock. In fact, snoozing is self‑care, and you allow yourself  activations of this wonderful invention before you finally get up.

Unfortunately, after a heavy night of partying, you know you must get up tomorrow for an important meeting. To make it on time, you want to know for what time you must set your alarm.

Your alarm clock works as follows: When the alarm rings, you may press the Snooze button. Each time you press it, the alarm will ring again exactly  minutes later. You plan to get at the -th ringing: that is, after snoozing exactly  times.

Input

The input consists of:

  • One line with the time where you have to get up. The time is given in 24-hour format “HH:MM”, both hours and minutes are given with two digits. The time is no earlier than 01:00 and no later than 11:59.
  • One line with an integer (): the duration of one snooze cycle, in minutes.
  • One line with an integer (): the number of times you will press the Snooze button.

Output

Output the time at which the alarm must initially ring, in 24‑hour format HH:MM, where both hours and minutes are written with two digits. Midnight is always written as 00:00.

1000 ms 2048 mb
pass-fail Thore Husfeldt cc by-sa Will Code for Drinks 2026

Login to submit

You need to login to submit attempts.