A,B,K=map(int,input().split()) import math AB=(A*B)//math.gcd(A,B) memo1=AB//A+AB//B-1 memo2=K%memo1 memo3=K//memo1 a=A b=B data=[AB] while a