h, w, la, lb, ka, kb = map(int, input().split()) ans = h + w 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)