h, w, la, lb, ka, kb = map(int, input().split()) def f(x, y): return min(h, x * la) * min(w, y * lb) + x * ka + y * kb ans = 1 << 60 for x in range(h + w + 10): l, r = 0, h + w + 10 if f(x, l) >= h * w: ans = min(ans, x) else: while r - l > 1: mid = (l + r) // 2 if f(x, mid) >= h * w: r = mid else: l = mid ans = min(ans, x + r) print(ans)