#include using namespace std; template void setmin(T & a, T const & b) { if (b < a) a = b; } int main() { int a, b, t; cin >> a >> b >> t; int ans = t+b; for (int i = 0; i <= t+b and t < ans; i += b) setmin(ans, i + (t-i + a-1)/a*a); cout << ans << endl; return 0; }