from math import gcd def check(x): ret = (x // A) + (x // B) - (x // (A * B // gcd(A, B))) if ret >= K: return True return False A,B,K = map(int,input().split()) ng = 0 ok = 1<<64 while ok - ng > 1: x = (ok+ng) // 2 if check(x): ok = x else: ng = x print(ok)