#include using namespace std; using ll = long long; using pll = pair; #define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i) #define rep(i, n) drep(i, 0, n - 1) #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second const ll MOD = 1000000007; const ll MOD2 = 998244353; const ll INF = 1LL << 60; const ll MAX_N = 2e5; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll h, w, la, lb, ka, kb; cin >> h >> w >> la >> lb >> ka >> kb; ll ans = INF; for(ll a=0; a<=10*((h+la-1)/la); a++){ if(a*ka >= h*w){ ans = min(ans, a); }else{ if(min(a*la, h)*lb+kb==0) continue; ll b = (h*w-a*ka + min(a*la, h)*lb+kb-1)/(min(a*la, h)*lb+kb); if(min(a*la, h)*min(b*lb, w)+a*ka+b*kb >= h*w){ ans = min(ans, a+b); } } } for(ll b=0; b<=10*((w+lb-1)/lb); b++){ if(b*kb >= h*w){ ans = min(ans, b); }else{ if(min(b*lb, w)*la+ka==0) continue; ll a = (h*w-b*kb + min(b*lb, w)*la+ka-1)/(min(b*lb, w)*la+ka); if(min(a*la, h)*min(b*lb, w)+a*ka+b*kb >= h*w){ ans = min(ans, a+b); } } } cout << ans << endl; }