#include using namespace std; typedef long long ll; int main() { int N, M, P, Q; scanf("%d %d %d %d", &N, &M, &P, &Q); int ans = 0; int end = P + Q - 1; while (N > 0) { int month = ans % 12 + 1; if (month >= P && month <= end) { N -= 2 * M; } else { N -= M; } ans++; } printf("%d\n", ans); return 0; }