#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>A>>B>>T; ll mi=(T+B-1)/B*B; for(ll a=0;a*B<=T && a<=2*A+1;a++) mi=min(mi,a*B+(T-a*B+A-1)/A*A); cout<