h, w, la, lb, ka, kb = map(int, input().split()) ans = (h - (ka + kb) // w + la - 1) // la + (w - (ka + kb) // h + lb - 1) // lb b = 0 for a in range(h, 0, -1): while b < w: if min(h, a * la) * min(w, b * lb) + a * ka + b * kb >= h * w: ans = min(ans, a + b) break b += 1 print(ans)