#include using namespace std; int main() { int n; cin >> n; int cnt = 0; int m, p, q; cin >> m >> p >> q; int hard[12] = {}; int crt = 1; for (int i = p; i < p + q; i++) { hard[i] = 1; } while (n > 0) { if (hard[crt]) { n -= 2 * m; } else { n -= m; } crt++; cnt++; if (crt == 13) { crt = 1; } } cout << cnt << endl; }