AtCoder Beginner Contest 123 - Five Transportations

In 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!
There are five means of transport in this empire:
 - Train: travels from City 1 to 2 in one minute. A train can occupy at most A people.
 - Bus: travels from City 2 to 3 in one minute. A bus can occupy at most B people.
 - Taxi: travels from City 3 to 4 in one minute. A taxi can occupy at most C people.
 - Airplane: travels from City 4 to 5 in one minute. An airplane can occupy at most D people.
 - Ship: travels from City 5 to 6 in one minute. A ship can occupy at most E people.
For each of them, one vehicle leaves the city at each integer time (time 0, 1, 2, ...).
There is a group of N people at City 1, and they all want to go to City 6.

At least how long does it take for all of them to reach there? 
You can ignore the time needed to transfer.  

-----Constraints-----
 - 1 \leq N, A, B, C, D, E \leq 10^{15}
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N
A
B
C
D
E

-----Output-----
Print the minimum time required for all of the people to reach City 6, in minutes.

-----Sample Input-----
5
3
2
4
3
5

-----Sample Output-----
7

One possible way to travel is as follows.
First, there are N = 5 people at City 1, as shown in the following image:

In the first minute, three people travels from City 1 to City 2 by train. Note that a train can only occupy at most three people.

In the second minute, the remaining two people travels from City 1 to City 2 by train, and two of the three people who were already at City 2 travels to City 3 by bus. Note that a bus can only occupy at most two people.

In the third minute, two people travels from City 2 to City 3 by train, and another two people travels from City 3 to City 4 by taxi.

From then on, if they continue traveling without stopping until they reach City 6, all of them can reach there in seven minutes.

There is no way for them to reach City 6 in 6 minutes or less.

Source: atcoder | Difficulty: EASY


Solutions:
n = int(input())
A = [int(input()) for i in range(5)]
print(5 + (n - 1) // min(A))


(N, *x) = map(int, open(0))
print(5 + (N - 1) // min(x))


import math
(n, *l) = map(int, open(0))
print(math.ceil(n / min(l)) + 4)


import math as mt
n = int(input())
lst = [int(input()) for i in range(5)]
print(mt.ceil(n / min(lst)) + 4)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 5 + (n - 1) // min(a, b, c, d, e)
print(ans)


(N, *A) = map(int, open(0).read().split())
print(5 + (N - 1) // min(A))


import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = math.ceil(n / min(a, b, c, d, e)) + 4
print(ans)


n = int(input())
a = []
for i in range(5):
	a.append(int(input()))
x = min(a)
t = n // x
if n % x != 0:
	t += 1
t += 4
print(t)


N = int(input())
l = [int(input()) for _ in range(5)]
bn = -(-N // min(l))
print(4 + bn)


n = int(input())
a = [int(input()) for _ in range(5)]
print(-(-n // min(a)) + 4)


n = int(input())
x = min([int(input()) for i in [0] * 5])
print((n + x - 1) // x + 4)


n = int(input())
x = list((int(input()) for i in range(5)))
print(-(-n // min(x)) + 4)


print(-(-int(input()) // min([int(input()) for _ in range(5)])) + 4)


import math
print(math.ceil(int(input()) / min([int(input()) for i in range(5)])) + 4)


lst = [int(input()) for _ in range(6)]
print(4 + -(-lst[0] // min(lst[1:])))


N = int(input())
A = [int(input()) for _ in range(5)]
print(-(-N // min(A)) - 1 + 5)


n = int(input())
a = [int(input()) for i in range(5)]
ans = 0
print(-(-n // min(a)) + 4)


n = int(input())
l = [int(input()) for i in range(5)]
print(-(-n // min(l)) + 4)


import math
N = int(input())
lsT = []
for i in range(5):
	lsT.append(int(input()))
print(4 + math.ceil(N / min(lsT)))


n = int(input())
m = min([int(input()) for x in range(5)])
print((m + n - 1) // m + 4)


(n, *l) = map(int, open(0).read().split())
print(4 + (n + min(l) - 1) // min(l))


import math
n = int(input())
capa = [int(input()) for _ in range(5)]
print(4 + math.ceil(n / min(capa)))


N = int(input())
ABCDE = [int(input()) for _ in range(5)]
print(4 + -(-N // min(ABCDE)))


(N, *T) = map(int, open(0).read().split())
t = min(T)
print((N + t - 1) // t + 4)


(n, *x) = [int(input()) for _ in range(6)]
print(-(-n // min(x)) + 4)


(n, *a) = map(int, open(0))
print(4 - -n // min(a))


N = int(input())
X = [int(input()) for _ in range(5)]
v = (N - 1) // min(X)
print(v + 5)


import math
people_num = int(input(''))
num_trans = []
for i in range(5):
	num_trans.append(int(input('')))
print(math.ceil(people_num / min(num_trans) + 4))


(N, *X) = [int(input()) for _ in range(6)]
mi = min(X)
print(4 + (N + mi - 1) // mi)


n = int(input())
x = min([int(input()) for _ in range(5)])
print(n // x + 5 if x != 1 else n // x + 4)


N = int(input())
A = [int(input()) for i in range(5)]
print(5 + -(-N // min(A)) - 1)


N = int(input())
T = [0] * 5
for i in range(5):
	T[i] = int(input())
from math import ceil
t = min(T)
print(ceil(N / t) + 4)


n = int(input())
C = [int(input()) for i in range(5)]
print(4 - -n // min(C))


n = int(input())
x = [int(input()) for _ in range(5)]
cap = min(x)
ans = (n + cap - 1) // cap + 4
print(ans)


N = int(input())
T = []
for _ in range(5):
	T.append(int(input()))
print((N + min(T) - 1) // min(T) + 4)


n = int(input())
lst = [int(input()) for i in range(5)]
ans = -(-n // min(lst)) + 4
print(ans)


import math
n = int(input())
abc = [int(input()) for i in range(5)]
ans = 4 + math.ceil(n / min(abc))
print(ans)


l = [int(input()) for _ in range(6)]
N = l[0]
l = l[1:]
print(-(-N // min(l)) + 4)


from math import ceil
(N, *A) = [int(input()) for _ in range(6)]
print(ceil(N / min(A)) + 4)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
aa = -(-n // a)
bb = -(-n // b)
cc = -(-n // c)
dd = -(-n // d)
ee = -(-n // e)
print(max(aa, bb, cc, dd, ee) + 4)


(N, *I) = [int(input()) for _ in range(6)]
mn = min(I)
print(5 + (N + mn - 1) // mn - 1)


print(~-int(input()) // min(eval('int(input()),' * 5)) + 5)


N = int(input())
min_ = min((int(input()) for _ in range(5)))
print((N - 1) // min_ + 5)


n = int(input())
t = [int(input()) for i in range(5)]
m = min(t)
print(-(-n // m) + 4)


import math
n = int(input())
A = [int(input()) for _ in range(5)]
ans = math.ceil(n / min(A)) + 4
print(ans)


n = int(input())
x = min([int(input()) for _ in range(5)])
print((n - 1) // x + 5)


n = int(input())
a = list((int(input()) for _ in range(5)))
Min = min(a)
if n <= Min:
	print(5)
	return
x = n // Min
if n % Min != 0:
	x += 1
print(4 - a.index(Min) + x + a.index(Min))


N = int(input())
A = [int(input()) for _ in range(5)]
ans = -(-N // min(A)) + 4
print(ans)


n = int(input())
a = [int(input()) for i in range(5)]
print((n - 1) // min(a) + 5)


(n, *a) = map(int, open(0).read().split())
a = min(a)
print(4 + (n + a - 1) // a)


n = int(input())
a = [int(input()) for _ in range(5)]
if n % min(a) != 0:
	n += min(a) - n % min(a)
if min(a) >= n:
	print(5)
else:
	print(int(n / min(a)) + 4)


n = int(input()) - 1
lst = [int(input()) for i in range(5)]
m = min(lst)
print(n // m + 5)


import math
n = int(input())
a = []
for i in range(5):
	a.append(int(input()))
print(4 + math.ceil(n / min(a)))


n = int(input())
lim = [int(input()) for _ in range(5)]
print(-(-n // min(lim)) + 4)


n = int(input())
abcde = [int(input()) for _ in range(5)]
print(4 - -n // min(abcde))


n = int(input())
l = list((int(input()) for _ in range(5)))
print(-(-n // min(l)) + 4)


(n, *d) = map(int, open(0))
bn = min(d)
print((n + bn - 1) // bn + 4)


n = int(input())
l = [int(input()) for _ in range(5)]
ans = 0 - -n // min(l) + 4
print(ans)


from math import *
N = int(input())
abcde = [int(input()) for _ in range(5)]
print(ceil(N / min(abcde)) + 4)


import math
n = int(input())
x = []
for i in range(5):
	x.append(int(input()))
if n == min(x):
	print(5)
else:
	print(4 + math.ceil(n / min(x)))


import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
_min = min([a, b, c, d, e])
_ans = math.ceil(n / _min)
print(_ans + 4)


N = int(input())
A = [-(-N // int(input())) for _ in range(5)]
print(5 + max(A) - 1)


n = int(input())
num = [int(input()) for _ in range(5)]
print(4 - n // -min(num))


N = int(input())
M = min((int(input()) for _ in [0] * 5))
print(N // M + (5 if N % M else 4))


a = [int(input()) for _ in range(6)]
b = min(a[1:])
print((a[0] + b - 1) // b + 4)


n = int(input())
a = [int(input()) for _ in range(5)]
print((n - 1) // min(a) + 5)


n = int(input())
mb = [int(input()) for i in range(5)]
print(-(-n // min(mb)) + 4)


print((int(input()) - 1) // min((int(input()) for i in [0] * 5)) + 5)


print(-(-int(input()) // min([int(input()) for i in range(5)])) + 4)


n = int(input())
t = [int(input()) for _ in range(5)]
m = min(t)
print((n + m - 1) // m + 4)


import math
N = int(input())
V = [int(input()) for _ in range(5)]
latest = min(V)
ans = math.ceil(N / latest) + 4
print(ans)


N = int(input())
ls = [int(input()) for _ in range(5)]
X = min(ls)
print((N + X - 1) // X + 4)


import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
input = sys.stdin.readline

def RD():
	return input().rstrip()

def F():
	return float(input().rstrip())

def I():
	return int(input().rstrip())

def MI():
	return map(int, input().split())

def MF():
	return map(float, input().split())

def LI():
	return list(map(int, input().split()))

def TI():
	return tuple(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def Init(H, W, num):
	return [[num for i in range(W)] for j in range(H)]

def main():
	N = I()
	L = [I() for i in range(5)]
	print(math.ceil(N / min(L) + 4))

def __starting_point():
	main()
__starting_point()


n = int(input())
tp = []
tmp = 10 ** 15
for _ in range(5):
	a = int(input())
	if tmp > a:
		tmp = a
	tp.append(a)
if tmp >= n:
	print(5)
	return
cnt = n // tmp
mod = n % tmp
if mod > 0:
	print(5 + cnt)
else:
	print(5 + cnt - 1)


n = int(input())
nu = min([int(input()) for i in range(5)])
print(4 + bool(n % nu) + n // nu)


N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
from math import ceil
a = ceil(N / A)
F = [A, B, C, D, E]
for i in range(1, 5):
	if F[i - 1] <= F[i]:
		a += 1
	else:
		b = ceil(N / F[i])
		a = max(a + 1, b + i)
print(a)


from math import ceil
(n, a, b, c, d, e) = [int(input()) for i in range(6)]
print(ceil(n / min(a, b, c, d, e)) + 4)


(N, *C) = [int(input()) for _ in range(6)]
print(4 + N // min(C) + (0 != N % min(C)))


a = [int(input()) for i in [0] * 6]
mini = min(a[1:])
print(-(-a[0] // mini) + 4)


print((int(input()) - 1) // min((int(input()) for _ in range(5))) + 5)


n = int(input())
a = []
import math
a.append(math.ceil(n / int(input())))
a.append(math.ceil(n / int(input())))
a.append(math.ceil(n / int(input())))
a.append(math.ceil(n / int(input())))
a.append(math.ceil(n / int(input())))
print(max(a) + 5 - 1)


n = int(input())
a = [int(input()) for i in range(5)]
amin = min(a)
a1 = (n - 1) // amin + 1 + 4
print(a1)


n = int(input())
l = [int(input()) for i in range(5)]
if n % min(l) == 0:
	print(n // min(l) + 4)
else:
	print(n // min(l) + 5)


a = []
for i in range(6):
	a.append(int(input()))
print((a[0] - 1) // min(a[1:]) + 5)


def solve(N, A, B, C, D, E):
	tmp = min(A, B, C, D, E)
	(tmp, tmp2) = divmod(N, tmp)
	tmp += 0 if tmp2 == 0 else 1
	print(tmp + 4)

def __starting_point():
	N = int(input())
	A = int(input())
	B = int(input())
	C = int(input())
	D = int(input())
	E = int(input())
	solve(N, A, B, C, D, E)
__starting_point()


n = int(input())
x = min([int(input()) for _ in range(5)])
(a, b) = divmod(n, x)
if b == 0:
	print(5 + (a - 1))
else:
	print(5 + a)


A = [int(input()) for _ in range(6)]
m = min(A[1:])
print((A[0] + m - 1) // m + 4)


N = int(input())
A = [int(input()) for i in range(5)]
X = min(A)
ans = (N + X - 1) // X + 4
print(ans)


N = int(input())
A = [0] * 5
for i in range(5):
	A[i] = int(input())
print(-(-N // min(A)) + 4)


(N, A, B, C, D, E) = [int(input()) for _ in range(6)]
x = min(A, B, C, D, E)
ans = (N - 1) // x + 5
print(ans)


from math import ceil
n = int(input())
a = [int(input()) for _ in range(5)]
print(ceil(n / min(a)) + 4)


N = int(input())
M = min((int(input()) for _ in [0] * 5))
print((N + M - 1) // M + 4)


N = int(input())
M = min([int(input()) for i in range(5)])
print((N + M - 1) // M + 4)


(n, *a) = [int(input()) for _ in range(6)]
print(max(int(n - 1) // min(a), 0) + 5)


a = [int(input()) for _ in range(6)]
n = a.pop(0)
b = min(a)
print((n - 1) // b + 5)


(N, *capas) = list(map(int, open(0).read().split()))
min_capa = min(capas)
print((N + min_capa - 1) // min_capa + 4)


(n, *a) = [int(input()) for i in range(6)]
m = sorted(a)[0]
print(n // m + 5 if n % m > 0 else n // m + 4)


n = int(input())
l = [int(input()) for i in range(5)]
print(5 + -(-n // min(l)) - 1)


(n, *a) = map(int, open(0))
m = min(a)
print((n + m - 1) // m + 4)


N = int(input())
t = [int(input()) for _ in range(5)]
a = min(t)
print(5 + (N - 1) // a)


(n, a, b, c, d, e) = [int(input()) for _ in range(6)]
print(4 + (0 - -n // min(a, b, c, d, e)))


(n, *l) = [int(input()) for _ in range(6)]
m = min(l)
if m == 1:
	print(n + 4)
else:
	print(n // m + 5)


(a, *b) = eval('int(input()),' * 6)
print(4 - -a // min(b))


(N, *A) = map(int, open(0).read().split())
print((N + min(A) - 1) // min(A) + 4)


import math
A = [int(input()) for _ in range(6)]
print(math.ceil(A[0] / min(A[1:])) + 4)


n = int(input())
data = [int(input()) for i in range(5)]
m = min(data)
if n % m == 0:
	print(4 + n // m)
else:
	print(5 + n // m)


(N, A, B, C, D, E) = [int(input()) for i in range(6)]
m = min(A, B, C, D, E)
print((N - 1) // m + 5)


(n, *ti) = [int(input()) for _ in range(6)]
import math
print(4 + math.ceil(n / min(ti)))


(N, *A) = map(int, open(0))
print(5 + (N - 1) // min(A))


n = int(input())
tp = [int(input()) for _ in range(5)]
print(-(-n // min(tp)) + 4)


print((int(input()) - 1) // sorted([int(input()) for _ in range(5)])[0] + 5)


h = int(input())
l = min([int(input()) for i in range(5)])
print(4 - -h // l)


n = int(input())
p = [int(input()) for _ in range(5)]
print((n - 1) // min(p) + 5)


a = [int(input()) for i in range(6)]
mi = min(a)
if a[0] == mi:
	print(5)
elif a[0] % mi == 0:
	print(5 + a[0] // mi - 1)
else:
	print(5 + a[0] // mi)


n = int(input())
m = [int(input()) for _ in range(5)]
s = min(m)
print((n % s > 0) + 4 + n // s)


N = int(input())
li = [0, 0, 0, 0, 0]
for i in range(5):
	li[i] = int(input())
if N % min(li) == 0:
	a = N // min(li) - 1
else:
	a = N // min(li)
ans = 5 + a
print(ans)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
num_list = [a, b, c, d, e]
if n % min(num_list) == 0:
	print(4 + n // min(num_list))
else:
	print(5 + n // min(num_list))


n = int(input())
x = [int(input()) for i in range(5)]
d = n // min(x)
if n % min(x) == 0:
	print(d + 4)
else:
	print(d + 5)


n = int(input())
gates = [int(input()) for _ in range(5)]
bn = min(gates)
print(int((n + bn - 1) / bn) + 4)


N = int(input())
nums = [int(input()) for _ in range(5)]
print(4 - -N // min(nums))


from math import ceil
n = int(input())
a = [int(input()) for i in range(5)]
print(ceil(n / min(a)) - 1 + 5)


(n, *l) = map(int, open(0).read().split())
print((n - 1) // min(l) + 5)


import math
members = 0
min_value = 10 ** 16
for i in range(6):
	if i == 0:
		members = int(input())
	else:
		current = int(input())
		if current < min_value:
			min_value = current
counter = math.ceil(members / min_value)
counter += 4
print(counter)


N = int(input())
ts = [int(input()) for i in range(5)]
print(int((N - 1) / min(ts)) + 5)


(n, *a) = [int(input()) for _ in range(6)]
print((n + min(a) - 1) // min(a) + 4)


(n, *cap) = map(int, open(0).read().split())
m = min(cap)
print(4 + (n + m - 1) // m)


n = int(input())
time = [int(input()) for _ in range(5)]
count = 0
if all([i >= n for i in time]):
	print(5)
else:
	smallest = min(time)
	smallest_index = time.index(smallest)
	count += n // smallest
	if n % smallest != 0:
		count += 1
	print(count + 4)


(n, a, b, c, d, e) = [int(input()) for _ in range(6)]
minVal = min(a, b, c, d, e)
if n // minVal == n / minVal:
	ans = n // minVal + 4
else:
	ans = n // minVal + 1 + 4
print(ans)


n = int(input())
t = [int(input()) for _ in range(5)]
k = (n - 1) // min(t)
print(k + 5)


from math import ceil
N = int(input())
A = [0] * 5
for i in range(5):
	A[i] = int(input())
ans = ceil(N / min(A)) + 4
print(ans)


import math

def main():
	n = int(input())
	csr = []
	for _ in range(5):
		csr.append(int(input()))
	print(4 + math.ceil(n / min(csr)))

def __starting_point():
	main()
__starting_point()


import math
a = int(input())
b = []
for i in range(5):
	b.append(int(input()))
c = min(b)
d = math.ceil(a / c)
print(d + 4)


import math
N = int(input())
A = [int(input()) for _ in range(5)]
n = min(A)
for i in range(5):
	if n == A[i]:
		p = i
		break
k = math.ceil(N / n)
print(k + 4)


n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
print(n // min(a, b, c, d, e) + 4) if n % min(a, b, c, d, e) == 0 else print(n // min(a, b, c, d, e) + 1 + 4)


N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
m = min(A, B, C, D, E)
if N % m != 0:
	print(N // m + 5)
else:
	print(N // m + 4)


n = int(input())
A = []
for i in range(5):
	A.append(int(input()))
minA = min(A)
import math
print(4 + math.ceil(n / minA))


(N, *x) = map(int, open(0))
print(4 - -N // min(x))


from math import *
n = int(input())
a = [int(input()) for _ in range(5)]
ans = ceil(n / a[0])
min = 0
for i in range(1, 5):
	if a[i] >= a[min]:
		ans += 1
	else:
		ans = ceil(n / a[i]) + i
		min = i
print(ans)


import math
N = int(input().rstrip())
A = int(input().rstrip())
B = int(input().rstrip())
C = int(input().rstrip())
D = int(input().rstrip())
E = int(input().rstrip())
print(math.ceil(N / min(A, B, C, D, E)) + 4)


(N, A, B, C, D, E) = [int(input()) for i in range(6)]
M = min(A, B, C, D, E)
print((N + M - 1) // M + 4)


import math
N = int(input())
A = [int(input()) for _ in range(5)]
print(math.ceil(N / min(A)) + 4)


n = int(input())
m = 10 ** 15 + 1
a = [int(input()) for _ in range(5)]
print((n - 1) // min(a) + 5)


import math
n = int(input())
nums = [int(input()) for _ in range(5)]
min_n = math.ceil(n / min(nums))
print(4 + min_n)


def main():
	n = int(input())
	data = [int(input()) for i in range(5)]
	(quo, rem) = divmod(n, min(data))
	print(4 + quo + bool(rem))
main()


(n, *t) = map(int, open(0).read().split())
print(int((n - 0.1) // min(t)) + 5)


n = int(input())
mv = [int(input()) for i in range(5)]
print(-(-n // min(mv)) + 4)


import math
import numpy as np
(N, *T) = list(map(int, open(0).read().split()))
X = np.array(T).min()
print(4 + math.ceil(N / float(X)))


(n, *x) = [int(input()) for i in range(6)]
print((n + min(x) - 1) // min(x) + 4)


(n, *city) = [int(input()) for _ in range(6)]
print(4 - -n // min(city))


n = int(input())
r = [int(input()) for _ in range(5)]
m = min(r)
print(-(-n // m) + 4)


N = int(input())
a = [int(input()) for _ in range(5)]
print(-(-N // min(a)) + 4)


(n, *a) = map(int, open(0))
p = min(a)
print([5, -(-n // p) + 4][n > p])


import math
N = int(input())
mobile = [int(input()) for _ in range(5)]
res = math.ceil(N / min(mobile)) + 4
print(res)


import math
N = int(input())
move = []
for i in range(5):
	move.append(int(input()))
movemin = min(move)
if movemin >= N:
	ans = 5
else:
	ans = math.ceil(N / movemin) + 4
print(ans)


N = int(input())
capa = [int(input()) for _ in range(5)]
for i in range(5):
	if capa[i] == min(capa):
		transmin = i
if capa[transmin] >= N:
	print(5)
elif N % capa[transmin] == 0:
	print(transmin + N // capa[transmin] + 4 - transmin)
else:
	print(transmin + N // capa[transmin] + 1 + 4 - transmin)


n = int(input())
a = [int(input()) for _ in range(5)]
a.sort()
print((n - 1) // a[0] + 5)


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	(N, *A) = list(map(int, read().split()))
	ans = 0
	for i in range(5):
		res = (N + A[i] - 1) // A[i] + 4
		if ans < res:
			ans = res
	print(ans)
	return

def __starting_point():
	main()
__starting_point()


(N, A, B, C, D, E) = [int(input()) for _ in range(6)]
ans = -(-N // min(A, B, C, D, E)) + 4
print(ans)


import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
move = [a, b, c, d, e]
f = min(a, b, c, d, e)
f_index = move.index(f) + 1
print(math.ceil(n / f) + (5 - f_index) + f_index - 1)


def main():
	import sys
	pin = sys.stdin.readline
	pout = sys.stdout.write
	perr = sys.stderr.write
	N = int(pin())
	A = int(pin())
	B = int(pin())
	C = int(pin())
	D = int(pin())
	E = int(pin())
	t = min(A, B, C, D, E)
	if N % t == 0:
		print(N // t + 4)
	else:
		print(N // t + 5)
	return
main()


N = int(input())
hum = [int(input()) for _ in range(5)]
print((N + min(hum) - 1) // min(hum) + 4)


N = int(input())
lst = [int(input()) for _ in range(5)]
print(4 + -(-N // min(lst)))


(n, *m) = map(int, open(0))
print(-(-n // min(m)) + 4)


import sys
from math import ceil
n = int(input())
m = 10 ** 18
for i in range(5):
	m = min(m, int(input()))
print(ceil(n / m) + 4)


import math
l = [int(input()) for i in range(6)]
print(math.ceil(l[0] / min(l) + 4))


(n, *p) = map(int, open(0))
print((~-min(p) + n) // min(p) + 4)


n = int(input())
t = [int(input()) for i in range(5)]
k = 0
for i in range(5):
	k = max(k, (n + t[i] - 1) // t[i])
print(k + 4)


N = int(input())
p = [int(input()) for _ in range(5)]
print(-(-N // min(p)) + 4)


N = int(input())
trafic = [int(input()) for i in range(5)]
print((N - 1) // min(trafic) + 5)


N = int(input())
L = [int(input()) for i in range(5)]
print((N - 1) // min(L) + 5)


n = [int(input()) for i in range(6)]
print(5 + (n[0] - 1) // min(n[1:]))


import math
N = int(input())
p = [0] * 5
bn = float('inf')
for i in range(5):
	p[i] = int(input())
	if bn > p[i]:
		bn = p[i]
ans = 0
print(math.ceil(N / bn) + (5 - 1))


(n, a, b, c, d, e) = [int(input()) for i in range(6)]
m = min(a, b, c, d, e)
k = 0 - -n // m
print(k + 4)


import math
N = int(input())
X = [int(input()), int(input()), int(input()), int(input()), int(input())]
print(math.ceil(N / min(X)) + 4)


i = [int(input()) for _ in range(6)]
m = min(i[1:])
print((i[0] - 1) // m + 5)


N = int(input())
L = [int(input()) for _ in range(5)]
m = min(L)
print(4 + (N + m - 1) // m)


N = int(input())
data = [int(input()) for _ in range(5)]
print(4 - -N // min(data))


N = int(input())
cost = [int(input()) for _ in range(5)]
cost.sort()
if N % cost[0] == 0:
	ans = 4 + N // cost[0]
else:
	ans = 4 + N // cost[0] + 1
print(ans)


n = int(input())
p_lis = [int(input()) for _ in range(5)]
print(-(-n // min(p_lis)) + 4)


def main():
	n = int(input())
	data = [int(input()) for i in range(5)]
	(quo, rem) = divmod(n, min(data))
	quo = 5 + quo
	if rem:
		print(quo)
	else:
		print(quo - 1)
main()


N = int(input())
lis = [int(input()) for _ in range(5)]
mini = min(lis)
group = (N + mini - 1) // mini
ans = 5 + group - 1
print(ans)


data = [int(input()) for i in range(6)]
print(-(-data[0] // min(data[1:])) + 4)


(a, *b) = eval('int(input()),' * 6)
print(~-a // min(b) + 5)


(n, a, b, c, d, e) = [int(input()) for i in range(6)]
print(-(-n // min(a, b, c, d, e)) + 4)


import math
(N, *C) = [int(input()) for i in range(6)]
print(math.ceil(N / min(C)) + 4)


f = lambda : int(input())
N = f()
D = [0] * 5
for i in range(5):
	D[i] = f()
m = min(D)
g = -(-(N - m) // m)
print(5 + g)


N = int(input())
move = []
for _ in range(5):
	move.append(int(input()))
min_value = min(move)
group_count = -(-N // min_value)
print(group_count - 1 + 5)


n = int(input())
x = float('inf')
for _ in range(5):
	a = int(input())
	x = min(x, a)
print((n - 1) // x + 5)


N = int(input())
A = [int(input()) for i in range(5)]
B = [0] * 6
cnt = 0
P = [0] * 9
B[0] = 10 ** 15
for m in range(9):
	for i in range(5, 0, -1):
		B[i] += min(A[i - 1], B[i - 1])
		B[i - 1] -= min(A[i - 1], B[i - 1])
	P[m] = B[5]
	cnt += 1
x = N // P[-1]
y = N % P[-1]
if y == 0:
	print(5 * x + 4)
	return
for j in range(7, 2, -1):
	if P[j] < y:
		time = 5 * x + j + 2
		print(time)
		return


n = int(input())
from math import ceil
(a, b, c, d, e) = [int(input()) for i in range(5)]
print(max(ceil(n / a), ceil(n / b), ceil(n / c), ceil(n / d), ceil(n / e)) + 4)


(n, *a) = eval('int(input()),' * 6)
print(4 - -n // min(a))


N = int(input())
H = []
for i in range(5):
	H += [int(input())]
print(-(-N // min(H)) + 4)


n = int(input())
capa = [int(input()) for _ in range(5)]
min_capa = min(capa)
if min_capa >= n:
	print(5)
elif n % min_capa == 0:
	print(5 + n // min_capa - 1)
else:
	print(5 + n // min_capa)


n = int(input())
x = [int(input()) for _ in range(5)]
p = min(x)
q = n // p
if n % p == 0:
	print(q + 4)
else:
	print(q + 5)


(N, *A) = [int(input()) for _ in range(6)]
print(4 + (N + min(A) - 1) // min(A))


a = [int(input()) for _ in [0] * 6]
print(~-a[0] // min(a[1:]) + 5)


(n, *l) = (int(input()) for _ in range(6))
print((n - 1) // min(l) + 5)


n = int(input())
ns = [int(input()) for _ in range(5)]
print((n - 1) // min(ns) + 5)