#B4295. Josephus Circle - Only Girls Eliminated

    ID: 11951 Type: Default 1000ms 256MiB

Josephus Circle - Only Girls Eliminated

Josephus Circle - Only Girls Eliminated

There are X boys and Y girls standing in a circle, numbered clockwise from 1 to X+Y. Given a positive integer K (with \(2 < K < X+Y\)), starting from position 1, the students count off in order. The student who calls K is eliminated from the circle, and the next student starts the next round by counting from 1. This process continues until only X students remain. Your task is to determine the initial positions where the boys should stand so that every student eliminated is a girl, ensuring that in the end, all the remaining students are boys. Output the positions of the boys in increasing order.

For example, when X=5, Y=3, and K=3, a valid arrangement is to place the boys at positions 2, 4, 5, 7, and 8.

inputFormat

The input consists of three integers: X, Y, and K, where X is the number of boys, Y is the number of girls, and K is the counting number satisfying \(2 < K < X+Y\).

outputFormat

Output the initial positions (in increasing order) where the boys should stand, separated by a space.

sample

5 3 3
2 4 5 7 8