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