#include using namespace std; int main(){ int N,M,P,Q; cin >> N >> M >> P >> Q; int tm = 0; while(N > 0){ for(int i = 1; 12 >= i; i++){ if(P <= i && i <= Q+P-1)N-=M; N-=M; if(N <= 0){ cout << i + tm * 12 << endl; break; } } tm++; } }