H,W,LA,LB,KA,KB=map(int,input().split()) if KA==0 and KB==0: print((H+LA-1)//LA+(W+LB-1)//LB) exit() ANS=10**9 for yoko in range((H+LA-1)//LA+1): teki=H*W yoko_damage=W*min(H,yoko*LA) no_damage=teki-yoko_damage if no_damage>=KA*yoko: no_damage-=KA*yoko else: yoko_damage-=KA*yoko-no_damage no_damage=0 #print(yoko,yoko_damage,no_damage) if yoko_damage<=0 and no_damage<=0: ANS=min(ANS,yoko) continue NG=0 OK=10**6+1 while OK>NG+1: mid=(OK+NG)//2 rest=max(0,yoko_damage-min(W,mid*LB)*min(H,yoko*LA))+no_damage if mid*KB>=rest: OK=mid else: NG=mid #print(yoko,OK) ANS=min(ANS,yoko+OK) H,W=W,H LA,LB=LB,LA KA,KB=KB,KA for yoko in range((H+LA-1)//LA+1): teki=H*W yoko_damage=W*min(H,yoko*LA) no_damage=teki-yoko_damage if no_damage>=KA*yoko: no_damage-=KA*yoko else: yoko_damage-=KA*yoko-no_damage no_damage=0 #print(yoko,yoko_damage,no_damage) if yoko_damage<=0 and no_damage<=0: ANS=min(ANS,yoko) continue NG=0 OK=10**6+1 while OK>NG+1: mid=(OK+NG)//2 rest=max(0,yoko_damage-min(W,mid*LB)*min(H,yoko*LA))+no_damage if mid*KB>=rest: OK=mid else: NG=mid #print(yoko,OK) ANS=min(ANS,yoko+OK) print(ANS)