Hide

Problem E
Hard Rocks and Atomic Clocks

/problems/mines22.hardrocksandatomicclocks/file/statement/en/img-0001.jpg
Photo taken by Ryan Mapes

As a bright physics student, you have been put in charge of overseeing Mines’ most promising new high-tech invention: a titanium-alloy drilling apparatus capable of boring through the toughest igneous rocks at record speeds. In theory.

In order to test this durable drill, it must be run continuously to ensure it will not break from strain. However, because of the heat it creates, power must be cycled to prevent it from overheating catastrophically. This power cycle must occur every hour, less than a minute after the turn of the hour. That’s your job — to prevent disaster by periodically resetting the drill.

The issue is that the only clock available in the physics lab is a high-precision atomic clock which displays the number of seconds since midnight. That is your input — the whole number of seconds as displayed on the atomic clock. You want to maximize how long you can doze off until you have to wake up and power-cycle the drill, because you did not get nearly enough sleep last night. Output the maximum whole number of minutes you can sleep for, so that when you wake up, it will be less than a minute before you need to reset the drill. You can assume that the drill was last reset at exactly the hour, so you can always sleep for at least one minute.

Input

A single positive integer between $0$ and $86\, 400$ representing the number of seconds since midnight, as displayed on the atomic clock.

You can assume that the input will never be exactly on the hour.

Output

Print a single positive integer $1 \leq x \leq 60$ representing the maximum whole number of minutes you can sleep for before needing to wake up and reset the drill.

Sample Input 1 Sample Output 1
3601
60
Sample Input 2 Sample Output 2
7199
1
Sample Input 3 Sample Output 3
19800
30
Sample Input 4 Sample Output 4
33435
43

Please log in to submit a solution to this problem

Log in