#include using namespace std; typedef long long ll; int main() { ll h, w, x, y, a, b; cin >> h >> w >> x >> y >> a >> b; ll ans = h + w; for (ll i = 0; i <= h + w; i++) { ll ng = -1, ok = h + w; while (abs(ok - ng) > 1) { int j = (ng + ok) / 2; if (h * w - min(h, i * x) * min(w, j * y) <= i * a + j * b) { ok = j; } else { ng = j; } } ans = min(ans, i + ok); } cout << ans << endl; }