import java.util.Scanner; class C{ static Scanner s=new Scanner(System.in); static long d,l,c,r; public static void main(String[] args){ d=s.nextLong(); l=s.nextLong(); c=s.nextLong(); r=s.nextLong(); if(d==0&&!kadomatsued()){ System.out.println(-1); }else if(kadomatsued()){ System.out.println(0); }else{ System.out.println(Math.min(Math.abs(l-c), Math.abs(r-c))/d+1); } } static boolean kadomatsued(){ return (c>l&&c>r)||(c