a, b, t = map(int,input().split()) # a円の切手x枚, b円の切手y枚 y = 0 ans = [] #X = [] #Y = [] while True: x = (t - b * y) // a if (t - b * y) % a != 0: x += 1 if x < 0 : break ans.append(a * x + b * y) #X.append(x) #Y.append(y) if b * y > t : break y += 1 #print(X) #print(Y) #print(ans) ans.sort() print(ans[0])