#K85722. Baton Relay Race: Find the Next Participant
Baton Relay Race: Find the Next Participant
Baton Relay Race: Find the Next Participant
In a relay race with n participants arranged in a circle, the baton is initially with the first participant. After k passes, determine which participant will receive the baton.
The passing mechanism follows a simple rule: when the baton is passed, it moves to the next participant in a clockwise order. After reaching the last participant, the baton goes back to the first participant, making the arrangement circular.
Mathematically, if we label the participants from 1 to n, the participant who receives the baton after k passes can be determined by the formula:
$$ \text{result} = (k \bmod n) + 1 $$
Your task is to implement a function that computes the participant's number who will hold the baton after k passes.
inputFormat
The input is given via standard input and consists of two space-separated integers:
- n (the number of participants), an integer.
- k (the number of passes), an integer.
You may assume that n is at least 1.
outputFormat
Output a single integer to the standard output representing the participant's number who will have the baton after k passes.
## sample5 2
3