#include #define rep(i,a,b) for(int i=int(a);i> A >> B >> T; ll ans = INF; int i; for(i = 0;i * i <= T && i * B <= T;i++){ ans = min(ans, (T - B * i + A - 1) / A * A + B * i); } //ans = min(ans, B * i); cout << ans << endl; }