from math import gcd def judge(x): return x//A+x//B-x//L>=K def binary_search(): l, r = 1, 10**19 while l<=r: m = (l+r)//2 if judge(m): r = m-1 else: l = m+1 return l A, B, K = map(int, input().split()) L = A*B//gcd(A, B) print(binary_search())