a,b,k=map(int,input().split()) aa=[i*a for i in range(1,k+2)] bb=[i*b for i in range(1,k+2)] a=sorted(list(set(aa+bb))) print(a[k-1])