# joseph2-q8
# Sections 1-5, Q.8, p.12, p.245
# inputs: 50 2 5

import math

n, k, s = map(int, input("n k s=? ").split())
q = k/(k-1)
x = 1 + k*(n-s)
a = math.ceil(x)
b = a
while b <= n*k:
  a = b
  b = math.ceil(q*a)
x = 1 + k*n - a
print("the", s, "th elim person has #", x)
