n,k,m = map(int,input().strip().split()) l = list(range(n)) while n>1: k = (k+m-1)%n l.pop(k) n -= 1 print(l[0])