cho.sh
Notes
Loading...

Picnic

Time limit

1s

Memory limit

128 MB

Problem

Dongho and his classmates went on a picnic. A total of N students take part in a counting-out game.

The N students sit in a circle clockwise, numbered from 1 to N. The game starts with student 1. Moving clockwise, the students count 1, 2, ... , K one by one. The student who says K leaves the circle. Counting then starts again from 1 with the next student still in the circle.

Dongho is student M. Given N, K, and M, determine the order in which Dongho leaves the circle.

Input

The first line contains three integers N, K, and M.

  • 1 <= N, M <= 5,000,000
  • M <= N
  • 1 <= K

Output

Print the order in which Dongho leaves the circle.

Constraints

  • 1 <= N, M <= 5,000,000
  • M <= N
  • 1 <= K