#include #include #include #include using namespace std; //namaega184 int main(){ int d;int h[3];scanf("%d",&d);for(int i=0;i<3;i++)scanf("%d",&h[i]); int ans=1000000000,inf=1000000000; auto nextpos=[&](int now,int next){return (now-(next-1)+d-1)/d;}; int h1=h[0],h2=h[2],m,a=0; if(h[0]>=h[1]){m=nextpos(h1,h[1]);h1-=d*m,a+=m;} if(h[0]<=h2){m=nextpos(h2,h[1]);a+=m,h2-=m*d;} if(h1==h2){m=nextpos(h1,h2);a+=m,h1-=m*d;} if(h1>=0&&h2>=0)ans=min(ans,a); h1=h[1],h2=min(h[0],h[2]),a=0; if(h[0]==h[2]){m=nextpos(h2,h[0]);a+=m,h2-=m*d;} if(h1>=h2){m=nextpos(h1,h2);h1-=d*m,a+=m;} if(h1>=0&&h2>=0)ans=min(ans,a); if(ans==inf)ans=-1; printf("%d\n",ans); return 0; }