N = int(eval(input()))

A = [int(eval(input())) for _ in range(5)]

a = min(A)

n=N//a

if N%a>0:

    n += 1

print((5+n-1))
N = int(eval(input()))

A = [int(eval(input())) for _ in range(5)]

a = min(A)

n = N//a

k = N%a

ans = 0

if n>0:

    ans = 5+(n-1)

    if k>0:

        ans += 1

else:

    if k>0:

        ans = 5

print(ans)
N = int(eval(input()))
A = [int(eval(input())) for _ in range(5)]
a = min(A)
n = N // a
if N % a > 0:
    n += 1
print((5 + n - 1))

N = int(eval(input()))
A = [int(eval(input())) for _ in range(5)]
a = min(A)
n = N // a
k = N % a
ans = 0
if n > 0:
    ans = 5 + (n - 1)
    if k > 0:
        ans += 1
else:
    if k > 0:
        ans = 5
print(ans)

-if N % a > 0: -    n += 1 -print((5 + n - 1)) +k = N % a +ans = 0 +if n > 0: +    ans = 5 + (n - 1) +    if k > 0: +        ans += 1 +else: +    if k > 0: +        ans = 5 +print(ans)