import math a,b,k=map(int,input().split()) ok=0 ng=10**30 c=a*b//math.gcd(a,b) while abs(ok-ng)>1: num=(ok+ng)//2 cnt=num//a+num//b-num//c if cnt