from math import gcd A, B, K = map(int, input().split()) lcm = A * (B // gcd(A, B)) def enum(x): return x//A + x//B - x//lcm l = 0 r = 10 ** 20 while r - l > 1: m = (l + r) // 2 if enum(m) >= K: r = m else: l = m print(r)