#include #include #include #include #include #include #include using namespace std; typedef long long LL; int main(){ LL A, B, T; cin >> A >> B >> T; if(A > B) swap(A, B); LL bc = (T + B-1) / B; LL ans = (1LL<<60); for(LL i = 0; i <= A; i++){ if(bc - i < 0) break; LL ac = (max(0, T - (bc-i)*B) + A - 1) / A; ans = min(ans, A*ac + B*(bc-i)); } cout << ans << endl; return 0; }