n, a, b, w, h = map(int, open('space.in').read().split())

left, right = 0, max(w, h)
while right - left > 1:
    mid = (left + right) // 2
    w1, h1 = w // (a + 2 * mid), h // (b + 2 * mid)
    w2, h2 = w // (b + 2 * mid), h // (a + 2 * mid)
    if (w1 * h1 >= n) or (w2 * h2 >= n):
        left = mid
    else:
        right = mid

print(left, file=open('space.out', 'w'))

