#include using namespace std; using ll = long long; #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define ALL(v) (v).begin(), (v).end() #define p(s) cout<<(s)<> A >> B >> C; ll year = 0; if(B+A-1 < C){ ll money_per_loop = B + A - 1; ll loop = C / money_per_loop; C %= money_per_loop; year = A * loop; } if(C<=A-1){ p(year+C); } else{ p(year+A); } return 0; }