def check(h, w): yoko = min(H, h * LA) tate = min(W, w * LB) nokori = H * W - yoko * tate return h * KA + w * KB - nokori >= 0 H, W, LA, LB, KA, KB = map(int, input().split()) ans = 10 ** 18 for h in range(H + 1): yes = 10 ** 6 if not check(h, yes): continue if check(h, 0): ans = min(ans, h) continue no = 0 while yes - no != 1: mid = (yes + no)//2 if check(h, mid): yes = mid else: no = mid ans = min(ans, h + yes) print(ans)