#MTHA0000014. Thời điểm tín hiệu kế tiếp (Next Signal Time)
Thời điểm tín hiệu kế tiếp (Next Signal Time)
Next Signal Time
Version: Phuoc Hung OJ Extended
Problem Statement
A signal first turns on at time and then every time units, at times . Given , find the earliest signal time not smaller than and the waiting time from to that signal.
Input
One line contains three positive integers , , and .
Output
Print two integers: the earliest signal time not smaller than and the corresponding waiting time.
Subtasks
- Subtask 1 (30 points):
- .
- .
- Subtask 2 (70 points):
- .
- .
Examples
Example 1
Input
4 6 17
Output
22 5
Explanation
The signal times around are and . The first one not smaller than is , so the wait is .
Example 2
Input
10 5 25
Output
25 0
Explanation
is exactly a signal time, so the earliest signal not smaller than is itself and the wait is .
Example 3
Input
1 100 2
Output
101 99
Explanation
After time , the next signal is at . Since lies between them, the answer is with a wait of .