#C10100. Ball Pass Game
Ball Pass Game
Ball Pass Game
There are n players standing in a circle and numbered from 1 to n. Initially, player 1 holds the ball. In each round, the ball is passed p positions clockwise. After m rounds, your task is to determine which player holds the ball.
The final ball holder can be calculated using the formula:
\[ \text{Result} = \Bigl( (1 + p \times m - 1) \bmod n \Bigr) + 1 \]
Use the input provided from standard input and print the result to standard output.
inputFormat
The input consists of a single line containing three space-separated integers n, p, and m, where:
- n is the number of players,
- p is the number of positions the ball is passed in each round,
- m is the number of rounds.
outputFormat
Output a single integer representing the number of the player who holds the ball after m rounds.
## sample5 2 3
2