#include int main () { long long h = 0LL; long long w = 0LL; long long la = 0LL; long long lb = 0LL; long long ka = 0LL; long long kb = 0LL; int res = 0; long long ans = 0LL; long long max = 0LL; res = scanf("%lld", &h); res = scanf("%lld", &w); res = scanf("%lld", &la); res = scanf("%lld", &lb); res = scanf("%lld", &ka); res = scanf("%lld", &kb); ans = h+w; max = h*w; if (kb > 0LL && max > 1LL+(h*w-1LL)/kb) { max = 1LL+(h*w-1LL)/kb; } for (long long a = 0LL; a <= h+w; a += 1LL) { long long tmp = 0LL; long long ar = la*a; long long b[2] = { -1LL, max }; long long br = 0LL; if (ar > h) { ar = h; } while (b[1]-b[0] > 1LL) { long long nxt = (b[0]+b[1])/2LL; long long br = nxt*lb; if (br > w) { br = w; } if (h*w-ar*br > ka*a+kb*nxt) { b[0] = nxt; } else { b[1] = nxt; } } br = b[1]*lb; if (br > w) { br = w; } if (h*w-ar*br <= ka*a+kb*b[1] && a+b[1] < ans) { ans = a+b[1]; } } printf("%lld\n", ans); return 0; }