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