#include using namespace std; typedef long long ll; int main(){ ll H, W, LA, LB, KA, KB; cin >> H >> W >> LA >> LB >> KA >> KB; ll ans = H + W + 1; ll j = W + 1; for (ll i = 0; i <= 2000000; i++){ ll tate = min(H, LA * i); ll ka_sum = KA * i; while(j > 0){ ll yoko = min(W, LB * (j - 1)); ll kb_sum = KB * (j - 1); if (ka_sum + kb_sum < H * W - tate * yoko){ break; } j--; } if (j != W + 1) ans = min(ans, i + j); } cout << ans << endl; }