#include #include #include #include #include #include #include using namespace std; #define repi(_I, _B, _E) for(int _I = (_B); (_I) < (_E); ++ (_I)) #define rep(_I, _N) for(int _I = 0; (_I) < (_N); ++ (_I)) #define all(_X) (_X).begin(), (_X).end() int a, b, t; int main() { cin >> a >> b >> t; int c = a + b; int ccnt = t / c; int u = t - ccnt * c; int m = 2000000000; int acnt = ((u + a - 1) / a); int bcnt = ((u + b - 1) / b); m = min(m, (ccnt + 1) * c); m = min(m, acnt * a + ccnt * c); m = min(m, bcnt * b + ccnt * c); cout << m << endl; return 0; }