#MTHA0000009. Ghế vòng tròn (Circular Seats)
Ghế vòng tròn (Circular Seats)
Circular Seats
Version: Phuoc Hung OJ Extended
Problem Statement
There are seats arranged in a circle and numbered from to . Seat follows seat . A student starts at seat and moves to the next seat clockwise at each step. Determine the seat after exactly steps.
Input
One line contains three integers , , and .
Output
Print the seat number after exactly steps.
Subtasks
- Subtask 1 (30 points):
- .
- .
- Subtask 2 (70 points):
- .
- .
Examples
Example 1
Input
8 3 0
Output
3
Explanation
No move is made, so the student remains at seat .
Example 2
Input
8 3 6
Output
1
Explanation
Starting from seat , six moves visit , so the final seat is .
Example 3
Input
100 100 1
Output
1
Explanation
Seat follows seat , so one step leads to seat .