#include #include #include #include #include using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);i++) const ll INF = 1e12; int main(void){ ll a, b, t; cin >> a >> b >> t; ll ans = INF; for (int i = 0; i <= 1e9; ++i){//bの数 if(b * i <= t){ int nokori = t - b * i; int j; if(nokori % a == 0){ j = nokori / a; }else{ j = nokori / a + 1; } ans = min(ans, (ll)(b * i + a * j)); }else{ //bの数のみで超えるとき ans = min(ans, (ll)(b * i)); break; } } printf("%d\n", ans); return 0; }