#include <bits/stdc++.h>

using namespace std;

int good(int a, int b, int c) {
    return 1LL * a * b >= c;
}

bool fits(int n, int a, int b, int w, int h, int d) {
    int ad = a + 2 * d;
    int bd = b + 2 * d;
    int ac = w / ad;
    int bc = h / bd;
    // ac * bc >= n?
    if (good(ac, bc, n)) {
        return true;
    } else {
        return false;
    }
}

int main() {
    freopen("space.in", "r", stdin);
    freopen("space.out", "w", stdout);

    int n, a, b, w, h;
    cin >> n >> a >> b >> w >> h;

    int ans = 0;
    for (int d = 0; true; d++) {
        if (!fits(n, a, b, w, h, d) && !fits(n, b, a, w, h, d)) {
            break;
        }
        ans = d;
    }
    cout << ans << endl;
    
    return 0;
}
