from math import lcm def bsearch(low: int, high: int, fun, is_complement=False) -> int: def pred(x: int) -> bool: return not fun(x) if is_complement else fun(x) lo = low hi = high res = low while lo <= hi: m = (lo + hi) // 2 if pred(m): res = max(res, m) lo = m + 1 else: hi = m - 1 return res + 1 if is_complement else res A, B, K = map(int, input().split()) # K 個以上あるか def can(m: int) -> bool: cnt = (m // A) + (m // B) - (m // lcm(A, B)) return cnt >= K ans = bsearch(1, 1 << 60, can, is_complement=True) print(ans)