Problem:


Score: 300 points

Problem Statement

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 1

5
3
2
4
3
5

Sample Output 1

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.

Sample Input 2

10
123
123
123
123
123

Sample Output 2

5

All kinds of vehicles can occupy N = 10 people at a time.
Thus, if they continue traveling without stopping until they reach City 6, all of them can reach there in five minutes.  

Sample Input 3

10000000007
2
3
5
7
11

Sample Output 3

5000000008

Note that the input or output may not fit into a 32-bit integer type.



Sample input:
5
3
2
4
3
5


Sample output:
7

Submission status: Accepted

Solution code:
N=int(input())
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

rissoku=min(A,B,C,D,E)
if N%rissoku==0:
    print(N//rissoku-1+5)
else:
    print(N//rissoku+5)

Submission status: Accepted

Solution code:
N = int(input())
min_capa = min([int(input()) for _ in range(5)])

delay = (N-1)//min_capa

print(5 + delay)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3


def solv(n, a, b, c, d, e):
    limited = min(a, b, c, d, e)
    ans = 4 + (n + (limited-1)) // limited
    return ans


if __name__ == '__main__':

    n = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())

    ans = solv(n, a, b, c, d, e)

    print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
mini = int(input())
for i in range(4):
    tmp = int(input())
    if tmp < mini:
        mini = tmp

print(math.ceil(n/mini) + 4)

Submission status: Accepted

Solution code:
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
list=[a,b,c,d,e]
min=10**16
ans=0
for i in range(5):
    if list[4-i]<min:
        min=list[4-i]
        ans=4-i
        x=4-i
ans+=6-(x+2)
ans+=-(-n//min)
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import os
import itertools
from math import *
    
pnum = int(input())

ctime = []
for i in range(5):
    ctime.append(int(input()))
    
#最小値をさがす
bneck = min(ctime)
bn_index = ctime.index(bneck)

#ボトルネック到達にかかる時間
bn_start_time = bn_index

#ボトルネックを通過するのにかかる時間
bn_thow_time = ceil(pnum / bneck)

#残りの移動にかかる時間
bn_nokori_time = 5 - bn_index

print(bn_index + bn_thow_time + bn_nokori_time - 1)

Submission status: Accepted

Solution code:
N = int(input())
l = []
for i in range(5):
    l.append(int(input()))
if min(l) == 1:
    print(N // min(l) + len(l) -1)
else:
    print(N // min(l) + len(l))

Submission status: Accepted

Solution code:
n=int(input())
arr=[]
for _ in range(5):
    arr.append(int(input()))

m=min(arr)
if n%m==0:
    print(4+n//m)
else:
    print(5+n//m)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import math

def main():
    N = int(input()) #counted people
    a = int(input()) #train
    b = int(input()) # bus
    c = int(input()) # taxi
    d = int(input()) # airplane
    e = int(input()) # boat

    lst = [a,b,c,d,e]
    mi = min(a,b,c,d,e) # 一番狭い人数
    index = lst.index(mi) # そこのインデックス
    mintime = math.ceil(N / mi) # ここを通るのにかかる時間
    
    #addr = 5 - index
    #ans = math.ceil(N / mi) + addr
    #print(ans,addr,math.ceil(N / mi),mi,index)
    
    print(mintime+4)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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(5 + (N // m) - 1)
else:
    print(5 + (N // m))

Submission status: Accepted

Solution code:
import math

n = int(input())
l=[]
for i in range(5):
    l.append(int(input()))

if n == 0:
    res = 0
else:
    res = math.ceil(n/min(l)) + 4

print(res)

Submission status: Accepted

Solution code:
n, *nums = [int(input()) for _ in range(6)]

neck = min(nums)

if neck >= n:
    print(5)
else:
    print((n - 1) // neck + 5)

Submission status: Accepted

Solution code:
N = int(input())
li = [int(input()) for i in range(5)]
ans = 0

if N <= min(li):
  ans = 5
elif N > min(li) and N % min(li) == 0:
  ans = N // min(li) + 4
else:
  ans = N // min(li) + 5
print(ans)

Submission status: Accepted

Solution code:
# C
import math
n = int(input())
a = []
for i in range(5):
    a.append(int(input()))
ans = math.ceil((n/min(a) + 5) - 1)
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
capacities = [int(input()) for _ in range(5)]
min_capatity = min(capacities)
cost = math.ceil(N / min_capatity)
print(cost + 4)

Submission status: Accepted

Solution code:
import math

N = int(input())
# A = int(input())
# B = int(input())
# C = int(input())
# D = int(input())
# E = int(input())
M = []
for i in range(5):
    M.append(int(input()))

print(math.ceil(N / min(M)) + 5 - 1)

Submission status: Accepted

Solution code:
n = int(input())
lst = [int(input()) for _ in range(5)]
t = 0
m = 0

for (index, ele) in enumerate(lst):
    done = min((t-index) * ele, n-m) #すでに運んだ人数
    m = n - done # 最後の組が到着時に, 最後の組みの者を含めて島にいる人数
    #print("m = {}, ele = {}".format(m, ele))
    if m % ele == 0:
        t += m // ele
        m = ele
        #print("1 : t = {}".format(t))
    else:
        t += m // ele + 1
        m =  m % ele
        #print("2 : t = {}".format(t))
print(t)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!


n = int(input())
a = [int(input()) for _ in range(5)]

ans = 0

if min(a)<n:
    nec_i = a.index(min(a))
    nec_n = n//a[nec_i]
    if n%a[nec_i] != 0:
        nec_n+=1
    ans = nec_n+4
else:
    ans = 5

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
moves = [int(input()) for i in range(5)]
neck = min(moves)
yobun = -(-1 * n // neck)
print(yobun + 4)

Submission status: Accepted

Solution code:
import sys

N = int(raw_input().split()[0])
M = []
for i in range(5):
    l = int(raw_input().split()[0])
    M.append(l)
# print(M, N)
a = min(M)
# print(a)
b = (N + a - 1) / a
print(b + 4)

Submission status: Accepted

Solution code:
import math

N = int(input())
li =[]
for i in range(5):
	li.append(int(input()))

mi_i = li.index(min(li))
mi_v = min(li)
if mi_v >= N:
	print(5)
else:
	print(math.ceil(N/mi_v)+4)

Submission status: Accepted

Solution code:
n = int(input())
minute_list = []
for i in range(5):
    minute_list.append(int(input()))
a = min(minute_list)
#print(a)
if n % a == 0:
    ans = 5 + (n/a - 1)
else:
    ans = 5 + ((n - n%a))/a
print(int(ans))

Submission status: Accepted

Solution code:
N = int(input())
min_time = 1000000000000000
for i in range(5):
    a = int(input())
    if min_time > a:
        min_time = a

if N % min_time == 0:
    waste_time = N // min_time - 1
else:
    waste_time = N // min_time
print(waste_time + 5)

Submission status: Accepted

Solution code:
read = input
n = int(read())
a = [read() for i in range(5)]
a = list(map(int, a))
a = min(a)
if n % a == 0:
    n = n // a
else :
    n = n // a + 1
print( n + 5 - 1 )

Submission status: Accepted

Solution code:
N = int(input())
t = [int(input()) for i in range(5)]
t.sort()
s = N//t[0]
if N%t[0] != 0 :
    s += 1
print(s+4)

Submission status: Accepted

Solution code:
N = int(input())
X = [int(input()) for i in range(5)]
min_x = min(X)
min_index = X.index(min_x)

if N%min_x==0:
    time = N//min_x
else:
    time = N//min_x+1

print(time+4)

Submission status: Accepted

Solution code:
import math
N=int(input())
TOSHI=[int(input()) for _ in range(5)]
COST=math.ceil(N/min(TOSHI))
print(4+COST)

Submission status: Accepted

Solution code:
n = int(input())
ans = 4
lis = []
for i in range(5):
    lis.append(int(input()))
minnum = min(lis)
ans += (n//minnum)
if n % minnum != 0:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a_min = min(a)
t = (n+a_min-1)//a_min + 4
print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = []
for _ in range(5):
    a.append(int(input()))


def m():
    if n == 1:
        return 5
    if min(a) == 1:
        return n+4
    return n // min(a) + 5


print(m())

Submission status: Accepted

Solution code:
import math

n = int(input())
capacity = [int(input()) for i in range(5)]

neck = min(capacity)
result = math.ceil(n / neck) + 5 - 1

print(result)

Submission status: Accepted

Solution code:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

if N / min(A, B, C, D, E) > int(N / min(A, B, C, D, E)):
    print(5 + int(N / min(A, B, C, D, E)))
else:
    print(4 + int(N / min(A, B, C, D, E)))

Submission status: Accepted

Solution code:
IN = [int(input()) for i in [0]*6]
N = IN[0]
AE = IN[1:]
P = [N,0,0,0,0,0]

bn = min(AE)

f = (N % bn == 0)
print(N//bn + 5 - f)

Submission status: Accepted

Solution code:
N=int(input())
num_list=[]
num_list.append(int(input()))
num_list.append(int(input()))
num_list.append(int(input()))
num_list.append(int(input()))
num_list.append(int(input()))

min_num=min(num_list)
if N%min_num==0:
    group=N//min_num
else:
    group=N//min_num+1
ans=5+(group-1)
print(ans)

Submission status: Accepted

Solution code:
import math 
step_list = []

for n in range(6):
  if n == 0:
    N = int(input())
  else:
    step_list.append(int(input()))

min_step = min(step_list)

a = math.ceil(N/min_step)

print(a+4)

Submission status: Accepted

Solution code:
#C
import math
N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
num = [a,b,c,d,e]
neck = min(num)
t = 4 + math.ceil(N / neck)
print(int(t))

Submission status: Accepted

Solution code:
n = int(input())

capacity = []

for i in range(5):
    c = int(input())
    capacity.append(c)

min_capacity = min(capacity)
print((n + min_capacity - 1) // min_capacity + 4)

Submission status: Accepted

Solution code:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A,B,C,D,E]
m = min(l)
mt = -(-N//m)-1
time = 5 + mt

print(time)

Submission status: Accepted

Solution code:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


from sys import stdin
import math



############################################

# read data for n sequences.
input=[]
for _ in range(6):
    input.append(int(stdin.readline().split()[0]))
N=input[0]
train=input[1:6]

mintrain=min(train)
ans=math.ceil(N/mintrain)+4
print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
t = [int(input()) for i in range(5)]

mi = t[0]
for i in t:
    mi = min(mi, i)

print(math.ceil(n/mi)+4)

Submission status: Accepted

Solution code:
from sys import stdin
import math
import numpy as np
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = [int(x) for x in stdin.readline().rstrip().split()]
x = []
for i in range(6):
  x.append(int(stdin.readline().rstrip().split()[0]))

N,A,B,C,D,E = x
neck = min([A,B,C,D,E])
k = (N-1)//neck+1
print(k+4)

Submission status: Accepted

Solution code:
n = int(input())
abc = []
abc.append(int(input()))
abc.append(int(input()))
abc.append(int(input()))
abc.append(int(input()))
abc.append(int(input()))

# abcdeのうち、スタート側にあり最小の数値とその位置を求める
min_num, min_index = abc[4], 4

for i in [3,2,1,0]:
  if abc[i] <= min_num:
    min_num, min_index = abc[i], i
    
# 最小の数値で何回に分けて乗せるか
min_nums = n // min_num if n % min_num == 0 else n // min_num + 1

# 最小の位置までの距離＋何回に分けて乗せるか＋最小の位置からの距離
print(min_nums + 4)

Submission status: Accepted

Solution code:
capa = []
n = int(input())

for i in range(5):
    capa.append(int(input()))

if n % min(capa)==0:
    print(n//min(capa)+4)
else:
    print(n//min(capa)+5)

Submission status: Accepted

Solution code:
import math


N = int(input())
nums = list(map(int, [input() for _ in range(5)]))
m = float('inf')
res = -1
for i, num in enumerate(nums):
  if num < m:
    m = num
    res = i
print(math.ceil(N / m) + 4)

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = s_inpl()   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import copy
from collections import defaultdict, Counter
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def i_inpl(): return int(input())
def s_inpl(): return map(int,input().split())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

N = i_inpl()
l = [int(input()) for i in range(5)]

t = 0
lmin = min(l)
print(math.ceil(N/lmin)+4)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(input()) for i in range(5)]
if all(a>=N for a in A):
    print(5)
else:
    ans = -(-N // min(A)) + 4
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

total = 0

lst = [a, b, c, d, e]

neck = min(lst)
idx = lst.index(neck)

# print(neck, idx)

d, m = divmod(n, neck)
if m > 0:
    total += 1

total += idx + d + (5 - idx - 1)

print(total)

Submission status: Accepted

Solution code:
def ii2ss(n):
    ss = []
    for i in range(n):
        ss.append(input())
    return ss

def sp2nn(sp, sep=' '):
    return [int(s) for s in sp.split(sep)]

def ss2nn(ss):
    return [int(s) for s in list(ss)]

import math
def main(ss):
    N, A, B, C, D, E = ss2nn(ss)
    m = min(A, B, C, D, E)
    return math.ceil(N / m) + 4

ss = ii2ss(6)
print(main(ss))

Submission status: Accepted

Solution code:
N = int(input())
num_ = [int(input()) for _ in range(5)]

num_.sort()


if N%num_[0] == 0:
  ans = int(N/num_[0])
else:
  ans = int(N/num_[0])+1
print(ans + 4)

Submission status: Accepted

Solution code:
n=int(input())
l=[]
for i in range(5):
  l.append(int(input()))
mn=min(l)
print(-(-n//mn)+4)

Submission status: Accepted

Solution code:
import sys
import math


def solve(lines):
    lines = [int(x) for x in lines]
    n = lines[0]
    lines = lines[1:]

    cap = min(lines)
    k = math.ceil(n / cap)
    print(4 + k)


if __name__ == '__main__':
    lines = sys.stdin.read()
    lines = lines.strip().split('\n')
    solve(lines)

Submission status: Accepted

Solution code:
# coding: utf-8
ns = [int(input()) for _ in range(6)]
ans = 0
min_n = min(ns[1:])
if ns[0] % min_n != 0:
    ans = 5 + ns[0] // min_n
else:
    ans = 5 + ns[0] // min_n - 1
print(ans)

Submission status: Accepted

Solution code:
from math import ceil
n = int(input())
Min = 1000000000000010
for _ in range(5):
    Min = min(Min, int(input()))
g = ceil(n / Min)
print(4 + g)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

def minute(p):
    p[5] += min(E,p[4])
    p[4] = max(0,p[4]-E)
    p[4] += min(D,p[3])
    p[3] = max(0,p[3]-D)
    p[3] += min(C,p[2])
    p[2] = max(0,p[2]-C)
    p[2] += min(B,p[1]) 
    p[1] = max(0,p[1]-B)
    p[1] += min(A,p[0])
    p[0] = max(0,p[0]-A)
    return p
    
p = [N,0,0,0,0,0]
for i in range(100):
    p = minute(p)
    if p[-1] == N:
        print(i+1)
        break
if p[-1] != N:
    r = p[-1]
    r_ = minute(p)[-1]
    x = r_-r
    from math import ceil
    print(100+ceil((N-r)/x))

Submission status: Accepted

Solution code:
N = int(input())
l = []
for i in range(5):
    l.append(int(input()))

mn = min(l)

print(-(-N//mn)+4)

Submission status: Accepted

Solution code:
N = int(input())
trans = []
for i in range(5):
    trans.append(int(input()))
a = min(trans)
b = -(-N // a)-1
print(5 + b)

Submission status: Accepted

Solution code:
import math

num = int(input())

cap_vehicles = [0,0,0,0,0]

for i in range(5):
  cap_vehicles[i] = int(input())

bottleNeck = min(cap_vehicles)

print(math.ceil(num / bottleNeck) + 4)

Submission status: Accepted

Solution code:
n=int(input())
a=list([int(input()) for i in range(5)])
cnt=0
if n%min(a)==0:
    cnt+=n//min(a)
else:
    cnt+=n//min(a)+1
print(cnt+4)

Submission status: Accepted

Solution code:
N = int(input())

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

tmplist = [A,B,C,D,E]
max_time_list = []
for x in tmplist:
    dim = N/x
    max_time_list.append(int(dim)+1 if int(dim)!=dim else int(dim))

print(max(max_time_list)+4)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
b=min(a)
if b<n:
    print(n//b+(n%b>0)-1+5)
else:
    print(5)

Submission status: Accepted

Solution code:
N, A, B, C, D, E = [int(input()) for _ in range(6)]

transportations = [A, B, C, D, E]

bottleneck = min(transportations)
bottleneck_way = transportations.index(bottleneck)

print(-(-N // bottleneck) + bottleneck_way + 4 - bottleneck_way)

Submission status: Accepted

Solution code:
def main():
	n = int(input())
	r = [0]*5
	r[0] = int(input())
	r[1] = int(input())
	r[2] = int(input())
	r[3] = int(input())
	r[4] = int(input())
	total = 4
	min_r = min(r)
	div = n // min_r
	mod = n % min_r
	total += div
	if mod != 0:
		total += 1

	print(total)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
x = []
for i in range(5):
    x.append(int(input()))

a = min(x)
if a >= N:
    print(5)
else:
    ans = -(-N // a)
    ans += 4
    print(ans)

Submission status: Accepted

Solution code:
# 2019/04/06
# AtCoder Beginner Contest 123 - C

# Input
n = int(input())
tl = list()
minval = 10 ** 16

for i in range(5):
    tl.append(int(input()))
    if tl[i] < minval:
        minval = tl[i]

ans = int(n / minval) + 4
if n % minval > 0:
    ans += 1

# Output
print(ans)

Submission status: Accepted

Solution code:
def __main__():
    N = int(input())
    trans = []
    for i in range(5):
        trans.append(int(input()))
    bn = min(trans)
    print(4 + (N-1)//bn + 1)
if __name__ == "__main__":
    __main__()

Submission status: Accepted

Solution code:
N = int(input())

numTr = []

for i in range(5):
  numTr.append(int(input()))
  
numTr.sort()

miniNum = N // numTr[0]
remNum = N % numTr[0]

if remNum != 0:
  miniNum += 1
  
minutes = miniNum + 4

print(minutes)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())
    norimono = [A,B,C,D,E]
    norimono.sort()
    kaisuu = N // norimono[0]
    if N % norimono[0] != 0:
        kaisuu += 1
    print(kaisuu + 4)

main()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read() for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
A = read_col(5, 1)[0]

# 一番小さい人数のところがボトルネック

key = min(A)

if N % key == 0:
    print(N//key+4)
else:
    print(N // key + 5)

Submission status: Accepted

Solution code:
from sys import stdin
import math

people = int(input())
sus = [int(input()) for i in range(5)]

minpeople = min(sus)

div = math.ceil(people/minpeople)

print(5+div-1)

Submission status: Accepted

Solution code:
import math

a = []

n =  int(input())


a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))

print( math.ceil(n/ min(a)) +4)

Submission status: Accepted

Solution code:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

list = [a,b,c,d,e]
list.sort()

div = list[0]

q = n // div
p = n % div

if p != 0:
    print(5+q)
else:
    print(4+q)

Submission status: Accepted

Solution code:
n = int(input())
a = []
for i in range(5):
    a.append(int(input()))

if n % min(a) == 0:
    print(n // min(a) + 4)
else:
    print(n // min(a) + 5)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

n =int(input())

m = -1
a = 9999988888999991

# n行の数をリストへ
t = [int(input()) for i in range(5)] 

for i in range(5):
    if t[i] <= a:
        m=i
        a=t[i]

answer = n//a 
if n % a == 0:
    answer -= 1
answer += 5
print( answer )

Submission status: Accepted

Solution code:
import math

n = int(input())
a = []
min_a = 10**15
for i in range(5):
    a.append(int(input()))
    if a[-1] < min_a:
        min_a = a[-1]

if min_a >= n:
    print(5)
else:
    print(math.ceil(n/min_a)+4)

Submission status: Accepted

Solution code:
import math
N = int(input())
A = [int(input()) for _ in range(5)]

mini = min(A)
index = A.index(mini)
index + 1
ans = 4 + math.ceil(N/mini)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ride=[int(input()) for x in [0]*5]
import math
print(5-1+math.ceil(n/min(ride)))

Submission status: Accepted

Solution code:
n = int(input())
capa = [int(input()) for _ in range(5)]
for i in range(0,4):
    if capa[i] < capa[i + 1]:
        capa[i + 1] = capa[i]
ans = 4 + n // capa[4] + (0 if n % capa[4] == 0 else 1)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
minn = float("inf")
for _ in range(5):
    n = int(input())
    minn = min(minn, n)
print((N - 1) // minn + 5)

Submission status: Accepted

Solution code:
import math
N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

trans = [a,b,c,d,e]
group = math.ceil(N/min(trans))
print((group-1)+5)

Submission status: Accepted

Solution code:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

st = []
st += [a,b,c,d,e]

print((n-1) // min(st) + 5)

Submission status: Accepted

Solution code:
import numpy as np
data = [int(input()) for _ in range(6)]
n = data[0]
ae = data[1:]
idx_band = np.argmin(ae)
band  = ae[idx_band]
print(np.ceil(n/band).astype(int) + 4 )

Submission status: Accepted

Solution code:
import sys,math
input = sys.stdin.readline

N,A,B,C,D,E=[int(input().strip()) for x in range(6)]

mini=min(A,B,C,D,E)
loss=math.ceil(N/mini)
print(4+loss)

Submission status: Accepted

Solution code:
n = int(input())
list = []
for i in range(5):
    a = int(input())
    list.append(a)

cnt = 0

min = 10**16
min_ind = 0
for i in range(5):
    if min > list[i]:
        min = list[i]
        min_ind = i


if n % list[min_ind] == 0:
    print(4 - min_ind + n // list[min_ind] + min_ind)
else:
    print(5 - min_ind + n // list[min_ind] + min_ind)

Submission status: Accepted

Solution code:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ans = -(-n // min((a,b,c,d,e))) + 4
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
limit = [int(input()) for _ in range(5)]
limit.sort()
print(((n + limit[0] - 1) // limit[0]) + 4)

Submission status: Accepted

Solution code:
from math import *
n=int(input())
arr=[]
for i in range(5):
	t=int(input())
	arr.append(t)
if(n%min(arr)==0):
	ans=4+(n//min(arr))
else:
	ans=5+(n//min(arr))
print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
ALPHA = []
for i in range(5):
    ALPHA.append(int(input()))

most_narrow = min(ALPHA)
print(str(math.ceil(N / most_narrow) + 4))

Submission status: Accepted

Solution code:
import math

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A, B, C, D, E]

p = math.ceil(N / min(l))

print(4 + p)

Submission status: Accepted

Solution code:
import math
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
inputs = [A, B, C, D, E]
howManyTimes = []
for num in inputs:
    howManyTimes.append(math.ceil(N / num))
bottleneck = howManyTimes.index(max(howManyTimes))

print(4 + howManyTimes[bottleneck])

Submission status: Accepted

Solution code:
N = input()
A2E = [input() for _ in range(5)]
print 4 + N / min(A2E) + min(1, N % min(A2E))

Submission status: Accepted

Solution code:
import math

list=[]

n=int(input())

for i in range(5):
    x=int(input())
    list.append([x, i])

list=sorted(list)
#print(list)

#print(list)

min=list[0][0]

neck=math.ceil(n/min)
print(neck+4)

Submission status: Accepted

Solution code:
N = int( input() )
A = [ int(input()) for _ in range(5) ]

minTrans = min( A[0], A[1] )
for i in range(2,5):
    minTrans = min( minTrans, A[i] )

print( (N+minTrans-1)//minTrans + 4 )

Submission status: Accepted

Solution code:
N = int(input())
l = [int(input()) for _ in range(5)]
m = min(l)
if N % m == 0:
    print(N//m+4)
else:
    print(N//m+5)

Submission status: Accepted

Solution code:
n = int(input())

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

min_v = min(a, b, c, d, e)

ans = 5
if n % min_v == 0:
    ans += n // min_v - 1
else:
    ans += (n // min_v)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

A=-(-n // a)
B=-(-n // b)
C=-(-n // c)
D=-(-n // d)
E=-(-n // e)

M=max([A,B,C,D,E])

X=M+4

print(X)

Submission status: Accepted

Solution code:
import math

N=int(input())
a=[]
for z in range(5):
  a.append(int(input()))

a=sorted(a)
buf=a[0]
ans=math.ceil(N/buf)+4
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
lim = [int(input()) for _ in range(5)]
m = min(lim)
if N%m==0:
    print(N//m+4)
else:
    print(N//m+5)

Submission status: Accepted

Solution code:
import math

N = int(input())
people = [int(input()) for _ in range(5)]
max_turn = max(map(lambda x: math.ceil(N / x), people))
print(max_turn + 4)

Submission status: Accepted

Solution code:
vehicles = []

N = int(input())

for _ in range(5):
    x = int(input())
    vehicles.append(x)

import math
min_num = N / min(vehicles)
min_num = math.ceil(min_num)
#print(min_num)

print(5 + min_num - 1)

Submission status: Accepted

Solution code:
import math
N = int(input())
Xs = [int(input()) for _ in range(5)] 

out = 4 + int(math.ceil(N / min(Xs)))
print(out)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
import math

def solve():
    N = int(input())
    vehicles = []
    for i in range(0, 5):
        vehicles.append(int(input()))
    
    botle_neck = vehicles[0]
    for i in range(1, 5):
        if vehicles[i] < botle_neck:
            botle_neck = vehicles[i]
            continue
        else:
            vehicles[i] = botle_neck
    
    # 結局vehicles[4] + 4分？
    ans = math.ceil(N/vehicles[4]) + 4

    print(ans)



if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import math

N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

min_num = min(a,b,c,d,e)

m = math.ceil(N / min_num)

total = m + 4

print(total)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

a = [0]*5
n = int(input())
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())

bottle = min(a[0],a[1],a[2],a[3],a[4])

time = 0

if n % bottle == 0:
    time = int(n / bottle)
else:
    time = int(n // bottle) + 1

if bottle >= n:
    print(5)
else:
    print(time+4)

Submission status: Accepted

Solution code:
import numpy as np


n = int(input())
minlim = 10**15
for i in range(5):
    lim = int(input())
    if lim < minlim:
        minlim = lim

if minlim < n:
    if n % minlim == 0:
        print(n//minlim + 4)
    else:
        print(n//minlim + 5)
else:
    print(5)

Submission status: Accepted

Solution code:
n = int(input())
mins = [(int(input()),idx) for idx in range(5)]
if min(mins)[0] > n:
    print(5)
else:
    ans = n // min(mins)[0] + 1 * ((n%(min(mins)[0]))>0)
    print(ans+4)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import math

N = int(input())
X = [N] + [int(input()) for _ in range(5)]

count = 0
for i in range(1, 6):
    if min(X[:i]) > X[i]:
        count += math.ceil((N - (count - i + 1) * X[i]) / X[i])
    else:
        count += 1
        
print(count)