#include using namespace std; /*{{{*/ //template #define REP(i,n) for(int i=0;i ostream& operator<<(ostream& os,const vector& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; } template ostream& operator<<(ostream& os,const pair& p){ os << "(" << p.first << ","<< p.second <<")"; return os; } typedef long long ll; typedef unsigned long long ull; typedef pair pii; typedef vector vi; typedef vector vvi; ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); } constexpr ll mod = 1e9+7; const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1}; /*}}}*/ int main(){ ll d; vector h(3); cin>>d; rep(i,3) cin>>h[i]; if(h[0]==0 and h[1] == 0 and h[2]==0){ cout << -1 << endl; return 0; } ll ans=0; if(h[0]==h[2]){ ans++; h[2]-=d; } if(h[0]!=h[1] and h[1]!=h[2]){ if(h[0]>h[1] and h[2]>h[1]){ cout << ans << endl; return 0; }else if(h[0] > h[1] and h[1] > h[2]){ cout << ans << endl; return 0; } } if(h[0] > h[2]) swap(h[0],h[2]); ll m = h[0]-1; ll d1 = ((h[1]-m)+d-1)/d; ll m2=h[1]-1; ll d2 = ((h[2]-m2)+d-1)/d; debug(h); debug2(d1,d2); cout << min(d1,d2)+ans << endl; }