import math a, b, k = map(int, input().split()) def calc(x): global a, b res = 0 res += x // a res += x // b res -= x // (a / math.gcd(a, b) * b) return res small, large = 0, 9999999999999999999999999 while small < large - 1: mid = small + large mid >>= 1 if calc(mid) < k: small = mid else: large = mid print(large)