#include using namespace std; using ll = long long; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> N >> M >> P >> Q; FOR(i, 1, 13){ fall[i] = M; } FOR(i, P, P+Q){ fall[i] *= 2; } ll count = 0; ll month = 1; for(;;){ if(month==13) month=1; N -= fall[month]; count++; if(N<=0){ p(count); return 0; } month++; } return 0; }