a, b, t = map(int, input().split()) ans = 1 << 60 for y in range(min(a, t // b) + 1): x = (t - b * y + a - 1) // a ans = min(ans, a * x + b * y) print(ans)