def solve(): A, B, T = list(map(int, input().split())) mi = T + A + B for y in range(A): x = (T - y * B + A - 1) // A mi = min(mi, A * x + B * y) if B * y > T: break print(mi) def main(): solve() if __name__ == '__main__': main()