import sys

def getMax(n, a, b, w, h):
    L = 0
    R = min(w, h) + 1
    while L + 1 < R:
        M = (L + R) // 2
        ad = a + 2 * M
        bd = b + 2 * M
        ac = w // ad
        bc = h // bd
        if ac * bc >= n:
            L = M
        else:
            R = M
    return L


sys.stdin = open("space.in", "r")
sys.stdout = open("space.out", "w")

n, a, b, w, h = map(int, input().split())
p1 = getMax(n, a, b, w, h)
p2 = getMax(n, b, a, w, h)
print(max(p1, p2))
