#yuki1350 import math a,b,k=map(int,input().split()) c=a//math.gcd(a,b)*b l=0 r=10**18 while r-l>1: mid=(l+r)//2 if mid//a+mid//b-mid//c>=k: r=mid else: l=mid print(r)