ECOO '21 P1 - Many Messages

View as PDF

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

Theodore likes to keep in touch with his friends at all times, even when he does homework. Unfortunately, sending and receiving a lot of messages from his friends has caused him to be distracted from doing his very important math homework.

To remedy this issue, Theodore has decided to only check his messages at set intervals of time, starting at some minute. For example, starting at minute , Theodore might decide that he wants to check his messages every minutes. Given this set interval the first time he checks his messages will be at minute . While studying, Theodore only accounts for the minutes he spends on his homework, disregarding the typical clock format of telling time. Theodore starts his homework at a certain time and decides to check his messages three times, separated by an interval.

Larry sends Theodore a message some time later. Given the interval Theodore uses to checks his messages, when will he read Larry's message?

Input Specification

The first line of input will consist of a single integer, the minute that Theodore starts doing his homework at.

The next line of input will consist of a single integer, the interval that Theodore wants to check his messages at.

The last line of input will consist of a single integer, the minute when Larry sent Theodore a message.

All integers in the input will be between and .

For of the points, Larry will always send his message after Theodore last checked his phone.

Output Specification

Output the first time when Theodore will see Larry's message. If Larry's message is sent after the last time Theodore checks his phone, output Who knows....

Sample Input 1

1
30
91

Sample Output 1

91

Explanation for Sample Output 1

The first time Theodore decides to check his messages is exactly minutes after minute , .

The second time Theodore checks his messages is minutes after the first time, .

The third time Theodore checks his messages is minutes after the second time, .

Larry sends his message just as Theo checks his messages for the last time at minutes.

Sample Input 2

5
19
4

Sample Output 2

24

Explanation for Sample Output 2

Theodore will see Larry's message the first time he checks them, at minutes.

Sample Input 3

2
10
99

Sample Output 3

Who knows...