import math A, B, K = map(int, input().split()) ng = 0 ok = A * K while ok - ng > 1: mid = (ng + ok) // 2 if mid // A + mid // B - mid // math.lcm(A, B) >= K: ok = mid else: ng = mid print(ok)