import sys

for line in sys.stdin:
    a = line.split()
    n, k, m = int(a[0]), int(a[1]), int(a[2])
    list = list(range(n))
    while len(list)>1:
        count = 1
        index = list.index(k)
        for i in range(m - 1):
            count += 1
            if index < len(list) - 1:
                index += 1
            else:
                index = 0

            if count == m:
                if index < len(list) - 1:
                    k = list[index + 1]
                    del list[index]
                else:
                    k = list[0]
                    del list[index]
    print(list[0])