from sys import stdin import math A,B,K = map(int,stdin.readline().split()) g = A*B // math.gcd(A,B) l = 0 r = (A+B)*K while r-l != 1: m = (l+r)//2 now = m // A + m // B - m // g if now >= K: r = m else: l = m #print (m,now) print (r)