import java.util.ArrayList;
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
while (in.hasNextInt()) { // 注意 while 处理多个 case
int n = in.nextInt();
int k = in.nextInt();
int m = in.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
boolean baoshu = false;
int count = 0;
int j = -1;
for(int i = 0;i<n;i++)
{
list.add(i);
}
while(list.size()>1){
j ++;
if(j == k && !baoshu)
{
baoshu = true;
}
if(baoshu){
count++;
}
// System.out.println("000:"+list.toString() +",j:"+j+",count:"+count);
if(count == m){
count = 0 ;
if(j == list.size()-1 ){
list.remove(j);
j = -1;
}else{
list.remove(j);
j = j-1;
}
// System.out.println("111:"+list.toString() +",j:"+j+",count:"+count);
}else{
if(j == list.size()-1 ){
j =-1;
}
// System.out.println("222:"+list.toString() +",j:"+j+",count:"+count);
}
}
System.out.println(list.get(0));
}
}
}