h,w,la,lb,ka,kb = map(int,input().split()) ans = (h+la-1)//la + (w+lb-1)//lb ma = ans now = 0 nk = 0 for i in range(ma)[::-1]: left = max(h-i*la,0) k = ka*i while k+nk < left*w: now += 1 nk += kb if now > ans: print(ans) exit() left2 = k+nk - left*w leftW = h-left while True: if leftW == 0: break if now*lb + left2//leftW >= w: break now += 1 nk += kb left2 += kb ans = min(ans,now+i) if now > ans: break print(ans)