n,m,p,q=map(int,input().split()) i,c=0,0 while n>0: if p<=1+(i%12)<=p+q-1: n-=(m*2) else: n-=m i+=1 c+=1 print(c)