A, B, T = map(int, input().split()) ans = 10 ** 18 now = 0 while T - now * B >= 0 and now <= A: ans = min(ans, (T - now * B + A - 1)//A*A + now * B) now += 1 print(min(ans, (T + B - 1)//B*B))