peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys
s = input()
for i in range(len(s)//2):
    if s[i] != s[len(s) - i - 1]:
        print("No")
        sys.exit(0)
for i in range((len(s) - 1)//4):
    if s[i] != s[(len(s) - 1)//2 - i - 1]:
        print("No")
        sys.exit(0)
print("Yes")
# Judge status: Accepted
N=int(input())
if int(N)%2==1:
  print(0)
  exit()
ans=0
N//=2
for i in range(1,1000):
  ans+=N//(5**i)
  if N<5**i:
    print(ans)
    exit()
# Judge status: Accepted
from sys import stdin
input = stdin.readline


def main():
  L = int(input())

  print((L/3)**3)


if(__name__ == '__main__'):
  main()
# Judge status: Accepted
# nabc123_b.py
# 調理時間%10=0 をとった後、調理時間%10 が大きい順にとって行く
dishes = [int(input()) for i in range(5)]
lest_time = 0
ans = 0
for dish in dishes:
    if dish%10==0:
        ans += (dish)
    else:
        ans += (dish+10-dish%10)
    if lest_time < 10-dish%10 and dish%10!=0:
        lest_time = 10-dish%10
print(ans-lest_time)
# Judge status: Accepted
N,P = map(int,input().split())
A = list(map(int, input().split()))
for i in A:
    if i % 2 == 1:
        print(2**(N-1))
        exit()
print(2 ** N if P == 0 else 0)
# Judge status: Wrong Answer
N = int(input())
S = input()

ans = ''
Z_s = 'Z'
for i in range(len(S)):
    ord_s = ord(S[i]) + N
    if ord_s > ord(Z_s):
        ord_s -= ord('Z') - ord('A')
    ans += chr(ord_s)
print(ans)
# Judge status: Accepted
N = int(input())
s = [(i+1, N-i-1) for i in range((N-1) // 2 + 1)]
ss = [sum(list(map(int,list(str(v[0])[::1])))) + sum(list(map(int,list(str(v[1])[::1])))) for v in s]
print(min(ss))
# Judge status: Wrong Answer
n = int(input())
d = list(map(int,input().split()))

d.sort
i = int(len(d)/2)

if d[i] == d[i-1]:
  print(0)
else:
  print(d[i])
# Judge status: Wrong Answer
import math
import sys
a, b, x = map(int, input().split())
up, down = 0, b
a_dec = 2*x / (a * b)
print(a_dec)
if a_dec > a:
    up = 2 * x/(a**2) - b
    up = b - up
    c = (a**2+up**2)**(1/2)
    sys.exit(0)
c = (a_dec**2+b**2)**(1/2)
print(math.degrees(math.asin(b/c)))
# Judge status: Accepted
import numpy as np
H = int(input())
count = 0
ans = 0

while True:
    H = np.floor(H/2)
    count += 1
    if H == 0:
        print(2 ** count - 1)
        break
# Judge status: Wrong Answer
n, m = map(int, input().split())
A, B = [], []
ans = 'IMPOSSIBLE'
for i in range(m):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
now = 1
result = n in B
if result == False:
    print(ans)
    exit()
else:
    be = B.index(n)
    before = A[be]
    for i in range(m):
        if B[i] == before:
            if A[i] == now:
                ans = 'POSSIBLE'
                break
print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    cnt = 0
    for i in range(n):
        if a[i] < b[i]:
            cnt += (b[i]-a[i])//2
        else:
            cnt += b[i]-a[i]
    if cnt >= 0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b = map(int,input().split())
print("Yes" if a==b else "No")
# Judge status: Wrong Answer
a, b = map(int, input().split())

myans = ''
if a > b:
    for i in range(a):
        myans += str(b)
elif b <= a:
    for i in range(b):
        myans += str(a)
print(myans)
# Judge status: Wrong Answer
import bisect

N = int(input())

*A, = map(int, input().split())
*B, = map(int, input().split())
*C, = map(int, input().split())
A.sort()
B.sort()
C.sort()

A_B = [0]*N
B_C = [0]*N

for i in range(N):
    count = 0
    index = bisect.bisect_right(A,B[i])
    A_B[i] = index 

for i in range(N):
    count = 0
    index = bisect.bisect_left(C,B[i])
    B_C[i] = len(C)-index

sum = 0
for i in range(N):
    sum = sum + B_C[i]*A_B[i]

print(sum)
# Judge status: Accepted
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
rsp = [set() for i in range(3)]
ans = 0
for i in range(N):
    if T[i] == 'r' and i - K not in rsp[0]:
        ans += P
        rsp[0].add(i)
    elif T[i] == 's' and i - K not in rsp[1]:
        ans += R
        rsp[1].add(i)
    elif T[i] == 'p' and i - K not in rsp[2]:
        ans += S
        rsp[2].add(i)
print(ans)
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    X = int(input())
    luck = (X // 500) * 1000 + (X % 500) // 5 * 5
    print(luck)

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
p= N%1000
if p==0:
    print(0)
else:
    print(1000-p)
# Judge status: Wrong Answer
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
l = LI()
print(l[0]+l[1])
# Judge status: Wrong Answer
ABC = [int(i) for i in input().split()]

m = sorted(ABC)
count = 0
if m[2]%2 == 0:
    m[2] += 1
    m[0] += 1
    count += 1
    
n = m[1] - m[0]
l = m[2] - m[1]

print(n//2 + l + count)
# Judge status: Accepted
N, K = map(int, input().split())
if N > K:
  N -= (N//K)*K
ans = N if N <= abs(N-K) else abs(N-K)
print(ans)

# flag = True
# while flag:
#   if N > K:
#     N = abs(N-K)
#   else:
#     ans = N if N <= N -K else N-K
#     flag = False
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = map(int, input().split())

    res = 0
    if 2 * n <= m:
        res += n
        m -= n * 2
        res += m // 4
    else:
        res += m // 2

    print(res)


if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
l=list(map(str,input().split()))
a=int(l[0]+l[1])+int(l[2])
b=int(l[0])+int(l[1]+l[2])

print(max(a,b))
# Judge status: Accepted
import sys

readline = sys.stdin.readline
N = int(readline())
CSF = [list(map(int, readline().split())) for _ in range(N-1)]
for i in range(N):
    time = 0
    for c, s, f in CSF[i:N-1]:
        if time < s:
            time = s
        else:
            time = (time+f-1)//f*f
        time += c
    print(time)
# Judge status: Accepted
r,g,b = [c for c in input().split()]
print("YES" if int(r+g+b) % 4 == 0 else "NO")
# Judge status: Accepted
import sys
input = sys.stdin.readline

N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()
ans = 0
i = 0

while i<N:
    lim = T[i]+K
    ans += 1
    cnt = 0
    
    while i<N and cnt<C and T[i]<=lim:
        i += 1
        cnt += 1
        
print(ans)
# Judge status: Accepted

a=int(input())
s=str(input())
if a>=3200:
    print(s)
else:
    print("red")
# Judge status: Accepted
A,B,C,X,Y = map(int,input().split())
C *= 2
ax = 0
bx = 0
num = 0
while ax < X or bx < Y:
  if ax < X and bx < Y:
    if A+B < C:
      num += A+B
    else:
      num += C
    ax += 1
    bx += 1
  elif ax < X:
    if A < C:
      num += A
    else:
      num += C
    ax += 1
  else:
    if B < C:
      num += B
    else:
      num += C
    bx += 1
print(num)
# Judge status: Wrong Answer
from operator import itemgetter
N = int(input())
T, A = map(int, input().split())
*H, = map(int, input().split())
avg = [[i+1, abs((T - h) * 0.006) - A] for i, h in enumerate(H)]
avg.sort(key=itemgetter(1))
print(avg[0][0])
# Judge status: Wrong Answer
def main():
    n, m = input().split()
    g1 = []
    g2 = []
    for _ in range(int(m)):
        x, y = input().split()
        if x == 1:
            g1.append(y)
        elif y == n:
            g2.append(x)
    sx = set(g1)
    sy = set(g2)
    sxy = sx.intersection(sy)
    if len(sxy):
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
X, K, D = map(int, input().split())

n = X // D

if K < n:
  ans = X - K * D

elif (K - n) % 2:
  ans = (n+1) * D - X
else:
  ans = X - n * D

print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a+b == c or a+c == b or b+c ==a:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
A, B, T = list(map(int, input().split()))
ans = 0
cnt = 1

while cnt < T+0.5:
  if cnt%A == 0:
    ans = ans + B
  cnt += 1
print(ans)
# Judge status: Wrong Answer
INF = 1000000000

h, n = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(n)]

maxA = max(AB[:][0])

dp = [INF for i in range(h+maxA)]
dp[0] = 0

for i in range(1, h+maxA):
    for ab in AB:
        a, b = ab[0], ab[1]
        if i-a >= 0:
            dp[i] = min(dp[i], dp[i-a] + b)

ans = min(dp[h:])

print(ans)
# Judge status: Accepted
import sys
def v():
    W,H,N=tuple(map(int,sys.stdin.readline().split()))
    lx,ux,ly,uy=0,W,0,H
    for _ in [0]*N:
        x,y,a=tuple(map(int,sys.stdin.readline().split()))
        if a==1 and lx<x:lx=x
        elif a==2 and ux>x:ux=x
        elif a==3 and ly<y:ly=y
        elif a==4 and uy>y:uy=y
    if lx<ux and ly<uy:print((ux-lx)*(uy-ly))
    else:print(0)
if __name__=='__main__':v()
# Judge status: Wrong Answer
t_h, t_a, a_h, a_a = [int(i) for i in input().split()]
aoki = a_h // t_a
takahashi = t_h // a_a

if aoki <= takahashi:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    A, B, C = LI()

    if (A, B, C).count(5) == 2 and (A, B, C).count(7) == 1:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    resolve()
# Judge status: Accepted
n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

for i in range(x,y+1):
    if all([p < i for p in a]) and all([q >=i for q in b]) and x < i <= y:
        print("No War")
        exit()
print("War")
# Judge status: Accepted
N,K = map(int,input().split())
S = list(input())

x = S[K-1]
S[K-1] = x.lower()

print("".join(S))
# Judge status: Wrong Answer
import math
n=int(input())
num=2
count=0
num2=int(math.sqrt(n))
while n!=1:
    if n%num==0:
        count+=1
        n=n//num
        num+=1
    else:
        num+=1
    if num2<num:
        if count==0:
            count=1
            break
        num2=int(math.sqrt(n))
        if num2<num and n>=num:
            count+=1
            break
        elif num2<num:
            break
print(count)
# Judge status: Wrong Answer
N=int(input())
from collections import deque
q=deque([1,2,3,4,5,6,7,8,9])
a=0
for _ in range(N):
  a=q.popleft()
  if a%10==0:
    q.append(a*10)
    q.append(a*10+1)
  if a%10==9:
    q.append(a*10+8)
    q.append(a*10+9)
  else:
    q.append(a*10+a%10-1)
    q.append(a*10+a%10)
    q.append(a*10+a%10+1)
print(a)
# Judge status: Wrong Answer
n=int(input())
a=[0] + list(map(int,input().split()))

state=[0]*(n+1)
m=0
b=[]
for i in reversed(range(n)):
    if state[i] != a[i]:
        m+=1
        b.append(i)
        j = 1
        while j*j <= i:
            if j % i == 0:
                state[j]=state[j]^1
                if j != i // j:
                    state[i//j]=state[i//j]^1
            j += 1
print(m)
print(*b)
# Judge status: Accepted
import collections
x,y,aa,bb,cc = map(int,raw_input().split(' '))

aas = map(int, raw_input().split(' '))
bbs = map(int, raw_input().split(' '))
ccs = map(int, raw_input().split(' '))

aas.sort(key = lambda x:-x)
bbs.sort(key = lambda x:-x)
ccs.sort(key = lambda x:-x)
aas = aas[:x]
bbs = bbs[:y]

r = (aas + bbs)
r.sort()

i = 0
j = 0
while(j < len(ccs) and i < len(r)):
	if ccs[j] > r[i]:
		r[i] = ccs[j]
		i+=1
	j+=1

print sum(r)
# Judge status: Wrong Answer
n = int(input())

a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ans = 0

for i in range(n-1):
    m1 = a1[:i+1]
    m2 = a2[i:]
    a = sum(m1)+sum(m2)
    ans = max(ans,a)

print(ans)
# Judge status: Wrong Answer
n = input()
a = int(input())
si = int(n[-2:])

if si > a:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
n = int(input())


st = set()

for i in range(n):
    s = input()
    st.add(s)


print(len(st))
# Judge status: Accepted
from collections import Counter

N = int(input())
S = list(input())
C = Counter(S)
MOD = 10 ** 9 + 7

ans = 1
for s,c in C.items():
  ans *= c + 1
  ans %= MOD

ans = (ans - 1) % MOD
print(ans)
# Judge status: Accepted
# coding: utf-8
n = int(input())

x = list(map(int, input().split()))
xs = sorted(x)
left = xs[n // 2 - 1]
right = xs[n // 2]

for i in range(n):
    if x[i] <= left:
        print(right)
    else:
        print(left)
# Judge status: Accepted
#文字列の入力
S = input()
 
#listを一文字ずつのlistに
S_list = list(S)
 
AorB = S_list[0]
counter = 0
for i in range(len(S_list)):
  if(AorB == S_list[i]):
    counter = counter + 1
 
if(counter == len(S_list)):
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
print(["ABD","ABC"][len(input())==3])
# Judge status: Wrong Answer
from math import floor

a, b = [int(i) for i in input().split()]
for i in range(0, 1011):
    print(i, floor(i * 0.08), floor(i * 0.1))
    if floor(i * 0.08) == a and floor(i * 0.1) == b:
        print(i)
        break
else:
    print(-1)
# Judge status: Accepted
S = input()

for i in range(1, len(S)-1):
    s = S[:-i]
    if len(s)%2 == 0 and s[:len(s)//2] == s[len(s)//2:]:
        ans = len(s)
        break

print(ans)
# Judge status: Wrong Answer
s=str(input())
# print(s)
List=list(s)
List.pop(-1)
# print(List)
ans=0
for i in range((len(List)//2)+1):
    R=List[0:i]
    L=List[i:i+len(R)]
    # print("L",L,"R",R)
    if(R==L):
        print(i,i+1,R,L)
        ans=len(R)*2

print(ans)
# Judge status: Wrong Answer
n,m,k = map(int,input().split())
ok = False
for i in range(1,n+1):
    for j in range(1,m+1):
        if i*(m-j)+(n-i)*j == k:
            ok = True
            break
if ok:print('Yes')
else:print('No')
# Judge status: Accepted
#!/usr/bin/env python3
def main():
    import sys
    import numpy as np

    read = sys.stdin.read

    N, W = map(int, input().split())
    wv = np.array(read().split(), dtype=np.int64)
    w = wv[::2]
    v = wv[1::2]

    dp = np.zeros(W + 1, dtype=np.int64)
    for can_w, can_v in zip(w, v):
        dp[can_w:] = np.maximum(dp[can_w:], dp[:-can_w] + can_v)

    print(dp[-1])


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
a=[a[i]-i-1 for i in range(n)]
x = sum(a) // n
y=x+1
p=[abs(i-x) for i in a]
q=[abs(i-y) for i in a]
print(min(sum(p),sum(q)))
# Judge status: Accepted
n,k,s=map(int,input().split())
ans=[s]*k+[197]*(n-k)
print(*ans)
# Judge status: Wrong Answer
K,A,B = map(int,input().split())

if K < A+2 or B <= A+2:
  print(K+1)
  exit(0)
  
K -= A - 1
p,q = divmod(K,2)
ans = (B-A) * p + q
print(ans)
# Judge status: Accepted
s = input()

if s=="RRR":
    print(3)
elif s=="RRS" or s=="SRR":
    print(2)
elif s=="SSS":
    print(0)
else:
    print(1)
# Judge status: Accepted

def main():
    T = list(input())
    for i in range(len(T)):
        if T[i] == '?':
            T[i] = 'D'

    print(''.join(T))

if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m = map(int,input().split())
if(n==2)or(m==2):
  print(0)
elif(n==1)or(m==1):
  if(n==1)and(m==1):
    print(1)
  else:
    print(max(0,max(n,m)-2))
else:
  print((n-2)*(m-2))
# Judge status: Wrong Answer
from functools import reduce
from operator import mul

n = int(input())
print(reduce(mul, range(1,n+1)))
# Judge status: Accepted
def main():
    S = input()
    if S == "ABC":
        print("ARC")
    else:
        print("ABC")


if __name__ == '__main__':
    main()
# Judge status: Accepted
W, H, x, y = map(int, input().split())
i = 0
if x*2 == W and y*2 == H:
  i = 1
print(W*H/2, i)
# Judge status: Accepted
from collections import defaultdict
n = int(input())
s = input()
l=1
tmp = 0
while(l<n):
    dd = set()
    dd2 = set()
    for i in range(0, l):
        dd.add(s[i])
    for i in range(l, n):
        dd2.add(s[i])
    tmp = max(tmp, len(dd&dd2))

    l+=1
print(tmp)
# Judge status: Wrong Answer
P,Q,R=map(int,input().split())

print(min(P+Q,Q+P,R+P))
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
l.sort()
print('Yes' if l[-1] <= sum(l[:-1]) else 'No')
# Judge status: Accepted
a, b, c = map(int, input().split())
print((a * b) // 2)
# Judge status: Wrong Answer
k,x = map(int,input().split())
ans = [i for i in range(k-abs(x)+1,k+abs(x))]
for i in ans:
  if -1000000 <= i <= 1000000:
    print(i,end='')
# Judge status: Wrong Answer
n = int(input())
kinds = set()
rainbow = 0
for a in list(map(int, input().split())):
    color = a // 400
    if color < 8:
        kinds.add(color)
    else:
        rainbow += 1

print(max(len(kinds), 1), min(8, len(kinds) + rainbow))
# Judge status: Accepted

n = int(input())
print(n // 2 * (n - n // 2))
# Judge status: Accepted
n, m = map(int, input().split())
if n%2 == 1:
    l = 1
    r = n-1
    for i in range(m):
        print(l, r)
        l += 1
        r -= 1
else:
    l = 1
    r = n-1
    flag = False
    for i in range(m):
        if (not flag) and r-l <= n//2:
            r -= 1
            flag = True
        print(l, r)
        l += 1
        r -= 1
# Judge status: Accepted
N,K = map(int, input().split())
print('0' if N % K == 0 else '1')
# Judge status: Accepted
a,b,k=map(int,input().split())
if a>b:
    a,b=b,a
s=0
for i in range(a+1,0,-1):
    if a%i==0 and b%i==0:
        s+=1
        if s==k:
            print(i)
            exit()
# Judge status: Wrong Answer
a=input()
l=len(a)
while l>0:
 # print(l)
  if l%2!=0:
    l -= 1
    a = a[:-1]
#    print(a)
  else:
    t =int(l/2)
    if a[0:t] == a[t:]:
      print(l)
      break
    else:
      l -= 1
# Judge status: Accepted
import numpy as np
import sys
input = sys.stdin.readline
 
N = int(input())
A = np.array(input().split(), dtype=np.int64)
B = np.array(input().split(), dtype=np.int64)
C = np.array(input().split(), dtype=np.int64)

A.sort()
C.sort()

A_cnt = np.searchsorted(A, B, side='left')
C_cnt = np.searchsorted(C, B, side='right')

ans = (A_cnt * (N-C_cnt)).sum()

print(ans)
# Judge status: Wrong Answer
n = int(input())
s = input()
if n < 3200:
    print(s)
else:
    print("red")
# Judge status: Wrong Answer
S=str(input())
list_ = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(S)):
  if len([1 for s in list_ if s==S[i]])>0:
    n=list_.index(S[i])
    list_ = list_[:n] + list_[n + 1:]
if len(list_)>1:
  print(list_[0])
else:
  print("None")
# Judge status: Accepted
k, x = map(int, input().split())
m = x-k+1
M = x+k-1
for i in range(m, M+1):
  print(i , end=" ")
# Judge status: Accepted
H, N = map(int, input().split())
A = list(map(int, input().split()))
sum_A = sum(A)

if H - sum_A <= 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import math
h=int(input())
k=math.ceil(math.log2(h))
print(2**k-1)
# Judge status: Accepted
x,y =map(int,input().split())
p=0
for i in range(x+1):
    t=i
    k=x-t
    tashi=2*t
    kashi=4*k
    if tashi+kashi==y:
        p=1
        print('Yes')
        break
if p==0:
    print('No')
# Judge status: Accepted
d,a={},0
for i in range(int(input())):
  k=''.join(sorted(input()))
  d[k]=d.get(k,-1)+1
  a+=d[k]
print(a)
# Judge status: Wrong Answer
# ABC118c
from functools import reduce
from fractions import gcd
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))


def gcds(*numbers):
    return reduce(gcd, numbers)


print(gcds(a))
exit(0)


def solve(l):
    m = min(l)
    nl = list()
    for i in l:
        if i % m != 0:
            nl.append(i % m)
    nl.append(m)
    # print(nl)
    if len(nl) == 1:
        return m
    return solve(nl)


print(solve(a))
# Judge status: Wrong Answer
import sys,math,collections,itertools,bisect
input = sys.stdin.readline

N,K=list(map(int,input().split()))
D = list(map(int,input().split()))
Ds = set([0,1,2,3,4,5,6,7,8,9])-set(D)
can = list(itertools.product(Ds,repeat = 5))
candi = []
for c in can:
    candi.append(10**4*c[0]+10**3*c[1]+10**2*c[2]+10**1*c[3]+c[4])
candi = sorted(candi)
print(candi[bisect.bisect_left(candi,N)])
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

import numpy as np

def main():
	n=II()
	A=[II() for _ in range(5)]
	print(5+(n-1)//min(A))









if __name__ == "__main__":
	main()
# Judge status: Wrong Answer
xl = list(map(int,input().split()))
for i in range(1,5):
  if xl[i] == 0:
    print(i+1)
  else :
    i = i + 1
# Judge status: Wrong Answer
def addRoute(i, c):
  t = ''
  for _ in range(i):
    t += c
  return t

pos=list(map(int, input().split()))
ud = pos[3] - pos[1]
rl = pos[2] - pos[0]
s = ''

s += addRoute(ud, 'U')
s += addRoute(rl, 'R')
s += addRoute(ud, 'D')
s += addRoute(rl, 'L')
s += 'L'
s += addRoute(ud+1, 'U')
s += addRoute(rl+1, 'R')
s += 'RR'
s += addRoute(ud+1, 'D')
s += addRoute(rl+1, 'L')
s += 'U'
print(s)
# Judge status: Accepted
s=input()
t=input()
st={}
ts={}

for x,y in zip(s,t):
  if x not in st:
    st[x]=y
  else:
    if st[x]!=y:
      print("No")
      exit()
  if y not in ts:
    ts[y]=x
  else:
    if ts[y]!=x:
      print("No")
      exit()
print("Yes")
# Judge status: Wrong Answer
# B Minor Change
S = list(input())
T = list(input())
l=len(S)
ct = 0
print(l)
for i in range(l):
    if S[i] != T[i]:
        ct += 1
print(ct)
# Judge status: Accepted
import sys
a,b = map(int, input().split())
s = input()
count = 0
if(s[a]!="-"):
    print("No")
    sys.exit()
else:
    for i in range (len(s)):
        if(s[i]=="-"):
            count += 1
if (count == 1):
    print("Yes")
else: 
    print("No")
# Judge status: Wrong Answer
n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

res = ['No'] * n
for i in range(n):
  if k - q + a.count(n+i) > 0:
    res[i] = 'Yes'
print('\n'.join(map(str, res)))
# Judge status: Wrong Answer
N = int(input())
ans = 0
count_dic = {}
for i in range(N):
    i_tmp = i
    count = 0
    while True:
        if i == 0:
            break
        elif i_tmp % 2 == 0:
            i_tmp = i_tmp / 2
            count += 1
        else:
            break
    count_dic[i] = count

print(max(count_dic, key=count_dic.get))
# Judge status: Accepted
N, *W = open(0).read().split()

is_ok = True

if len(W) != len(set(W)):
    is_ok = False
else:
    for i, w in enumerate(W):
        if i > 0:
            if before_w != w[0]:
                is_ok = False
                break
        
        before_w = w[-1]
    
if is_ok:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
x,y=map(int,input().split())
#print(y-x,x-y+2,1+y+x)
l=[]
if y-x>=0:
    l.append(y-x)
if x-y+2>=0:
    l.append(x-y+2)
if 1+y+x>=0:
    l.append(1+y+x)
print(min(l))
# Judge status: Accepted
import sys
k,bisc_to_yen,yen_to_bisc = map(int,input().split())
if yen_to_bisc - bisc_to_yen <= 2 or k-1 < bisc_to_yen:# 後者は、「あと二回で終了」までに地道増やしが間に合わない場合
    print(k+1)
    sys.exit()
before_change = bisc_to_yen - 1
remain = k - before_change
num_change = remain//2
ans = num_change*(yen_to_bisc-bisc_to_yen)
if remain % 2 == 1:
    ans += 1
print(ans+bisc_to_yen)
# Judge status: Accepted
s = list(input())

a = b = c = 0
for i in s:
    if i == "a":
        a += 1
    elif i == "b":
        b += 1
    else:
        c += 1

if a*b*c == 0 and a+b+c > 2:
    print("NO")
elif max(a,b,c)-min(a,b,c) >= 2:
    print("NO")
else:
    print("YES")