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