#include <stdio.h>
#include<stdlib.h>
typedef struct Node{
int n;
struct Node*next;}
Node;
int main() {
int a, b,c;
while (scanf("%d %d %d", &a, &b,&c) != EOF) { // 注意 while 处理多个 case
// 64 位输出请用 printf("%lld") to
Node*h=NULL;
Node*t=NULL;
Node*p=NULL;
for(int i=0;i<a;i++){
p=(Node*)malloc(sizeof(Node));
p->n=i;
p->next=NULL;
if(h==NULL){
h=p;
t=p;
}else{
t->next=p;
t=p;
}}
t->next=h;
Node*cu=h;
while(cu->n!=b) cu=cu->next;
while(cu->next!=cu){
for(int i=0;i<c-2;i++) cu=cu->next;
Node*oNode=cu->next;
cu->next=oNode->next;
free(oNode);
cu=cu->next;}
printf("%d",cu->n);
}
return 0;
}