import java.util.ArrayList;
import java.util.List;

public class Answer79 {
	public static int choice(int count, int start, int move) {
		List<Integer> list = new ArrayList<Integer>();
		for (int index = 0; index < count; index++) list.add(index);

		for (int index = (start - 1) % count; list.size() > 1; index = (index - 1 + move) % list.size()) {
			list.remove(index);
		}
		return list.get(0) + 1;
	}

	public static void main(String[] args) {
		System.out.println(choice(8, 5, 3));
		System.out.println(choice(10000, 10000, 10000));
		System.out.println(choice(100000, 100000, 100000));
	}
}
