#include using namespace std; class Node{ public: Node *prev; int d; Node *next; Node(int d){ this->d=d; } }; int n, m, k; Node *root; int main(){ scanf("%d %d %d", &n, &m ,&k); root=new Node(1); Node *index=root; for (int i=2;i<=n;i++){ index->next=new Node(i); index->next->prev=index; index=index->next; } index->next=root; root->prev=index; index=root; for (int i=0;i<k;i++){ for (int j=0;j<m-1;j++){ index=index->next; } index->prev->next=index->next; index->next->prev=index->prev; index=index->next; } printf("%d \n", index->d); }