#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int32_t n, m, p, q; cin >> n >> m >> p >> q; int32_t ans = n / ((12 - q) * m + q * (2 * m)) * 12; n %= ((12 - q) * m + q * (2 * m)); for (auto i = 1; i < p && n > 0; ++i) { ++ans; n -= m; } for (auto i = p; i < p + q && n > 0; ++i) { ++ans; n -= m * 2; } ans += (n + m - 1) / m; cout << ans << endl; return 0; }