#include using namespace std; using lint = long long int; template using V = vector; template using VV = V< V >; template void assign(V& v, int n, const T& a = T()) { v.assign(n, a); } template void assign(V& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); } int main() { cin.tie(NULL); ios::sync_with_stdio(false); int n, m, p, q; cin >> n >> m >> p >> q; int res = 1; while (true) { int t = (res - 1)% 12 + 1; if (p <= t and t < p + q) n -= 2 * m; else n -= m; if (n <= 0) return cout << res << '\n', 0; res++; } }