#include #include #include using namespace std; template bool maxPointer(T& a, T b) { if (a < b) {a = b;return true;}return false;} template int maxReturn(T a, T b) {if (a > b) {return a;} else {return b;}} template bool minPointer(T& a, T b) {if (a < b) {a = b;return true;}return false;} int main(void){ int N,M,P,Q,month = 1,res=0,windBounus=1; cin >> N >> M >> P >> Q; for(; N > 0; res++) { if (month == P+Q) windBounus = 1; if (month == 13) month = 1; if (month == P) windBounus = 2; N -= M * windBounus; month++; } cout << res << endl; }