#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=1LL<<60; for(ll y=0; y*B <= T+B && y<=A; y++) mi=min(mi, y*B+ (T-y*B+A-1)/A*A); cout<