#include using namespace std; int main() { int N, M, P, Q; cin >> N >> M >> P >> Q; int year = Q * 2 * M + (12 - Q) * M; long long ans = 0; ans = (N / year) * 12; N %= year; for (int i = 1; i <= 12; i++) { if (P <= i && i < P + Q) { N -= 2 * M; } else { N -= M; } ans++; if (N <= 0) { break; } } cout << ans; }