# joseph1.py
# Fig. 5.6 
# inputs: 50 2 5
'''
  The Josephus problem for a group of size n and step k. 
  Info: https://en.wikipedia.org/wiki/Josephus_problem
'''

n,k,s = map(int, input("n k s=? ").split())
x = k*s
while x > n:
  x = int((k*(x-n)-1)/(k-1))
print(f"The {s}th eliminated person is labeled #{x}")
