A,B,K = map(int,input().split()) def gcd(a,b): if b==0:return a return gcd(b,a%b) d = gcd(A,B) C = A*B//d high = 2*K low = 0 while high-low>1: mid = (high+low)//2 a = A*mid na = mid nb = a//B nc = a//C k = na+nb-nc if k>=K: high = mid else: low = mid ka = high high = 2*K low = 0 while high-low>1: mid = (high+low)//2 b = B*mid na = b//A nb = mid nc = b//C k = na+nb-nc if k>=K: high = mid else: low = mid kb = high a = A*ka na = ka nb = a//B nc = a//C if na+nb-nc==K: print(a) else: print(B*kb)