#include #include #include using namespace std; #define RREP(i,s,e) for (i = s; i >= e; i--) #define rrep(i,n) RREP(i,n,0) #define REP(i,s,e) for (i = s; i < e; i++) #define rep(i,n) REP(i,0,n) #define INF 1e8 typedef long long ll; int main() { int d, h1, h2, h3; cin >> d >> h1 >> h2 >> h3; if (h2 == 0 && (h1 == 0 || h3 == 0)) cout << -1 << endl; else if (h2 < min(h1,h3) || h2 > max(h1,h3)) cout << 0 << endl; else cout << min(abs(h2-h1),abs(h2-h3)) / d + 1 << endl; return 0; }