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