#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int u, v; ll w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int main() { ll d; cin >> d; if (d == 0) { cout << -1 << endl; return 0; } ll a, b, c; cin >> a >> b >> c; ll x = (max(0LL, b - min(a, c) + 1) + d - 1) / d; if (a == 0 || c == 0) x = INT_MAX; ll y = (max(0LL, a - b + 1) + d - 1) / d + (max(0LL, c - b + 1) + d - 1) / d; if (b == 0) y = INT_MAX; ll z = min(x, y); if (z == INT_MAX) z = -1; cout << z << endl; }