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

b = N%a

if b==0:

    print((5+n-1))

else:

    print((5+n))
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
b = N % a
if b == 0:
    print((5 + n - 1))
else:
    print((5 + n))

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