#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m, p, q;
    cin >> n >> m >> p >> q;
    int ans = 0;
    for (int i = 1; n; i = max(1, (i + 1) % 13)) {
        n = max(0, n - ((p <= i && i <= q) ? 2 * m : m));
        ans++;
    }
    cout << ans << endl;
    return 0;
}