A,B,K=map(int,input().split()) s=set() for i in range(K+1): s.add(i*A) s.add(i*B) print(sorted(s)[K])