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