d=int(raw_input())
H1=int(raw_input())
H2=int(raw_input())
H3=int(raw_input())
def kadomatsu(h1,h2,h3):
if h1
h3 and h1!=h3:
return True
if h1>h2 and h2H3
t1,t2=max(0,(H1-H2+d)/d),max(0,(H3-H2+d)/d)
h1,h3=max(0,H1-t1*d),max(0,H3-t2*d)
if kadomatsu(h1,H2,h3):
#print t1,"+",t2
ans=min(ans,t1+t2)
elif h3>0 and max(h3-d,0)!=h1:
#print t1,"+",t2,"+1"
ans=min(ans,t1+t2+1)
# case H1>H2