Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline
n,p = [int(i) for i in input().split()]
s = input()
ans = 0

if p == 2 or p == 5:
  s = list(s)
  for i,si in enumerate(s):
    if int(si)%p == 0:
      ans += i+1
  print(int(ans))

else:
  chk = [0]*p
  chk[0] = 1
  m = 0
  for i in range(n)[::-1]:
    m = (int(s[i])*(10**(n-1-i))+m)%p
    #print(i,m)
    chk[m] += 1
  for i in chk:
    ans += i*(i-1)/2
  print(int(ans))

### FIXED CODE ###

import sys
input = sys.stdin.readline
n,p = [int(i) for i in input().split()]
s = input()
ans = 0

import math
def nCr(n, r):
  if n < r:
    return 0
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if p == 2 or p == 5:
    for i in range(n):
        if int(s[i]) % p == 0:
            ans += i + 1
    print(ans)
    exit()

else:
  chk = [0]*p
  chk[0] = 1
  m = 0
  for i in range(n)[::-1]:
    m = (int(s[i])*pow(10,n-1-i,p)+m)%p
    chk[m] += 1
  for i in chk:
    ans += nCr(i,2)
  print(ans)
day = int(input())
if day == 22:
  print('Christmas Eve Eve Eve')
else if day == 23:
   print('Christmas Eve Eve')
else if day == 24:
   print('Christmas Eve')
else:
  print( print('Christmas)
  

### FIXED CODE ###

day = int(input())
if day == 22:
    print("Christmas Eve Eve Eve")
if day == 23:
    
    print("Christmas Eve Eve")

if day == 24:
    
    print("Christmas Eve")

if day == 25:
    
    print("Christmas")
s=input()
t=input()

alp='abcdefghijklmnopqrstuvwxyz'
d={}
e={}
for i in range(len(alp)):
    d[i]=alp[i]
    e[alp[i]]=i


c=[]
q=''
for i in range(len(t)+1):
    q=(t[:i] + '?'*(len(t)-i))
    m=s.rfind(q)
    if m==-1:
        continue

    c.append(m)


h=[]
for j in range(len(t),len(s)+1,1):
    q='?'*j
    m=s.rfind(q)
    if m==-1:
        continue
    h.append(m)

ans=''
if len(c)==0 and len(h)==0:
    ans='UNRESTORABLE'
elif len(c)>0 and len(h)==0:
    index=max(c)
    j=0
    for i in range(len(s)):
        if i>=index and i<= index+len(t):
            ans+=t[j]
            j+=1
        elif s[i]=='?':
            ans+='a'
        else:
            ans+=s[i]     
elif len(h)>0 and len(c)==0:
    index=max(h)
    j=0
    for i in range(len(s)):
        if i>=index and i<= index+len(t):
            ans+=t[j]
            j+=1
        elif s[i]=='?':
            ans+='a'
        else:
            ans+=s[i] 
else:
    index=max(max(c),max(h))
    j=0
    for i in range(len(s)):
        if i>=index and i<= index+len(t):
            ans+=t[j]
            j+=1
        elif s[i]=='?':
            ans+='a'
        else:
            ans+=s[i] 

print(ans)


### FIXED CODE ###

s=input()
t=input()


kouho=[]
for i in range(len(s)-len(t)+1):
    ans=s[:i]
    tmp=s[i:(i+len(t))]

    for j in range(len(t)):
        if tmp[j]==t[j]:
            ans+=t[j]
        elif tmp[j]=='?': 
            ans+=t[j]
        elif tmp[j]!='?' and tmp[j]!=t[j]:
            break
    ans=ans+s[(i+len(t)):]

    if len(ans)==len(s):
        kouho.append(ans)

if len(kouho)==0:
    print('UNRESTORABLE')
    exit(0)

answers=[]
for j in kouho:

    tmp_ans=''
    for k in range(len(j)):
        if j[k]=='?':
            tmp_ans+='a'
        else:
            tmp_ans+=j[k]

    answers.append(tmp_ans)

answers=sorted(answers)
print(answers[0])
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]

BC.sort(key=lambda x: x[1], reverse=True)
A.sort()
l, r = 0, M
s = 0
for B, C in BC:
    if A[l] >= C:
        break
    a, b = l, r
    if A[r] >= C:
        while a + 1 < b:
            i = a + (b - a) // 2
            if A[i] >= C:
                b = i
            else:
                a = i
        r = b
    n = B + l
    if n > r:
        n = r
    if n <= b:
        A[l:n] = [C] * B
        l = n
    else:
        A[l:b] = [C] * B
        l = b
    if l == r:
        break

print(sum(A))

### FIXED CODE ###

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]

BC.sort(key=lambda x: x[1], reverse=True)
A.sort()
l, r = 0, N
for B, C in BC:
    if A[l] >= C:
        break
    a, b = l, r
    if A[r - 1] >= C:
        while a + 1 < b:
            i = a + (b - a) // 2
            if A[i] >= C:
                b = i
            else:
                a = i
        r = b
    n = B + l
    if n > r:
        n = r
        B = n - l
    if n <= b:
        A[l:n] = [C] * B
        l = n
    else:
        A[l:b] = [C] * B
        l = b
    if l == r:
        break

print(sum(A))
from collections import deque

def solve(n,k,a):
    pos=[]
    neg=[]
    mod = 10**9 + 7
    ans = 1
    if k == n:
        for i in a:
            ans = ans * i % mod
        return ans
    else:
        for i in a:
            if i >0:
                pos.append(i)
            elif i<0:
                neg.append(i)

        if len(neg) + len(pos) < 0:
            return 0            
        elif len(pos)== 0:
            if k%2== 1:
                neg.sort(reverse=True)
                for i in neg[:k]:
                    ans = ans * i % mod
                return ans
            else:
                neg.sort()
                for i in neg[:k]:
                    ans = ans * i % mod
                return ans
        elif len(neg)==0:
            pos.sort(reverse=True)
            for i in pos[:k]:
                ans = ans * i % mod
            return ans
        else:
            pos.sort()
            neg.sort(reverse=True)
            ctr = 0
            if k%2 == 1:
                ans = ans * pos.pop() % mod
                ctr +=1
            pos = deque(pos)
            neg = deque(neg)

            while ctr < k:
                if len(pos) <= 1:
                    ans = ans * neg.pop() * neg.pop() %mod 
                elif len(neg) <= 1:
                    ans = ans * pos.pop() * pos.pop() %mod
                else:
                    tmp_p = pos[-1] * pos[-2] %mod
                    tmp_n = neg[-1] * neg[-2] %mod
                    if tmp_p >=tmp_n:
                        ans = ans * tmp_p %mod
                        pos.pop()
                        pos.pop()
                    else:
                        ans = ans * tmp_n %mod
                        neg.pop()
                        neg.pop()
                ctr+=2
            return ans
                    
n, k = map(int, input().split())
A = list(map(int,input().split()))
ans = solve(n,k,A)
print(ans)

### FIXED CODE ###

def solve(n,k,a):
    mod = 10**9 + 7
    ans = 1
    l = 0
    r = n-1
    a.sort()
    
    if k%2 == 1:
        ans *= a[r]
        r-=1
    
    if ans < 0:
        ans = 1
        for i in range(k):
            ans*= a[n-i-1]
            ans%= mod
        return ans
    
    for i in range(k//2):
        tmp_min=a[l]*a[l+1]
        tmp_max=a[r]*a[r-1]
        if tmp_max> tmp_min:
            ans*=tmp_max
            ans%=mod
            r-=2
        else:
            ans*= tmp_min
            ans%=mod
            l+=2
    return ans


n, k = map(int, input().split())
A = list(map(int,input().split()))
ans = solve(n,k,A)
print(ans)
h,n=map(int,input().split())
a=list(map(int,innput().split()))

if sum(a)>=h:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

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

if sum(a)>=h:
  print("Yes")
else:
  print("No")
if __name__=="__main__":
    N = int(input())
    l = list(map(int,input().split(" ")))
    record = []
    dic = {i:l[i] for i in range(N)}
    count = 0
    sorted_list = sorted(dic.items(),key=lambda d:d[1],reverse=True)
    if sorted_list[0][1]>0:
        while dic[N-1]<dic[N-2]:
            dic[N-1]=dic[N-1]+sorted_list[count][1]
            record.append([sorted_list[count][0],N-1])
        for i in range(N-2,0,-1):
            count = 0
            if dic[i]>=dic[i-1]:
                continue
            while dic[i]<dic[i-1]:
                if dic[i] + sorted_list[count][1]>dic[i+1]:
                    count+=1
                    continue
                dic[i] = dic[i] + sorted_list[count][1]
            record.append([sorted_list[count][0], i])
    else:
        sorted_list = sorted(dic.items(),key=lambda d:d[1],reverse=False)
        while dic[N - 1] < dic[N - 2]:
            dic[N - 2] = dic[N - 2] + sorted_list[count][1]
            record.append([sorted_list[count][0], N - 2])
        for i in range(N - 2, 0, -1):
            count = 0
            if dic[i] >= dic[i - 1]:
                continue
            while dic[i] < dic[i - 1]:
                dic[i-1] = dic[i-1] + sorted_list[count][1]
            record.append([sorted_list[count][0], i-1])
    print(len(record))
    for i in range(len(record)):
         print(str(record[i][0]+1)+" "+str(record[i][1]+1))

### FIXED CODE ###

if __name__=="__main__":
    N = int(input())
    l = list(map(int,input().split(" ")))
    record = []
    dic = {i:l[i] for i in range(N)}
    sorted_list = sorted(dic.items(),key=lambda d:d[1],reverse=True)
    if sorted_list[N-1][1]>=0:
        for i in range(N-1):
            record.append([i, i+1])
    elif sorted_list[0][1]<0:
        for i in range(N-1,0,-1):
            record.append([i, i-1])
    elif sorted_list[0][1]+sorted_list[N-1][1]>=0:
        record.append([sorted_list[0][0], 0])
        record.append([sorted_list[0][0], 1])
        record.append([0,1])
        for i in range(1,N-1):
            record.append([sorted_list[0][0], i+1])
            record.append([i,i+1])
    elif sorted_list[0][1]+sorted_list[N-1][1]<0:
        record.append([sorted_list[N-1][0], N-1])
        record.append([sorted_list[N-1][0], N-2])
        record.append([N-1,N-2])
        for i in range(N-2,0,-1):
            record.append([sorted_list[N-1][0], i-1])
            record.append([i,i-1])
    print(len(record))
    for i in range(len(record)):
         print(str(record[i][0]+1)+" "+str(record[i][1]+1))
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))

H = int(l1[0])
N = int(l1[1])
A = int(sum(l2))
result = H - A
print(A)
if result <= 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

l = list(map(int, input().split()))

def attack(l):
    H = l[0]
    A = l[1]
    cnt = 0
    while H > 0:
        H -= A
        cnt += 1
    return cnt

print(attack(l))
import numpy as np

n, w = [int(i) for i in input().split()]
a = np.array([[int(n) for n in input().split()] for i in range(n)])
a = a[np.argsort(a[:, 1] / a[:, 0])][::-1]

sv = {}
for ww, vv in a:
    added = {}
    for k, v in sv.items():
        added[ww+k] = vv+v
    for k, v in added.items():
        if (k <= w) and (k not in sv or v > sv[k]):
            sv[k] = v

    if (ww <= w) and (ww not in sv or vv > sv[ww]):
        sv[ww] = vv

print(max(sv.values()))

### FIXED CODE ###

n, w = [int(i) for i in input().split()]
a = [[int(n) for n in input().split()] for i in range(n)]

sv = {}
for ww, vv in a:
    added = {}
    for k, v in sv.items():
        added[ww+k] = vv+v
    for k, v in added.items():
        if (k <= w) and (k not in sv or v > sv[k]):
            sv[k] = v

    if (ww <= w) and (ww not in sv or vv > sv[ww]):
        sv[ww] = vv

print(max(sv.values()))
s = list(input())

cnt = []
c = 0
for i in s:
    if i == "A" or i == "C" or i == "G" or i =="T":
        c += 1
    else:
        cnt.append(c)
        c = 0

print(max(cnt))


### FIXED CODE ###

s = list(input())

cnt = []
c = 0
for i in s:
    if i == "A" or i == "C" or i == "G" or i == "T":
        c += 1
    else:
        cnt.append(c)
        c = 0
cnt.append(c)

print(max(cnt))
A, B, C, D = map(int, input().split())

import math

E = C*D/math.gcd(C, D)
interval = B-A+1


n1 = math.ceil(A/C)
n2 = math.ceil(A/D)
n3 = math.ceil(A/E)


m1 = math.floor(B/C)
m2 = math.floor(B/D)
m3 = math.floor(B/E)

cnt_c = m1-n1+1
cnt_d = m2-n2+1
cnt_cd = m3-n3+1

print(interval-(cnt_c+cnt_d-cnt_cd))

### FIXED CODE ###

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

import math

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return int(a/gcd(a, b)*b)

def myfunc(x, div1, div2):
    div3 = lcm(div1, div2)
    return x-x//div1-x//div2+x//div3

print(myfunc(B, C, D)-myfunc(A-1, C, D))
def getNumNeg(L):
    return sum([i<0 for i in L])
  
def findmax2(L):
    numNeg = getNumNeg(L)
    absL = list(map(abs, L))
    if numNeg % 2 == 0:
        print(sum(absL))
    else:
        print(sum(absL)-min(absL))
        
n = int(input())
a = list(map(abs, input().split()))
findmax2(a)

### FIXED CODE ###

def getNumNeg(L):
  return sum([i<0 for i in L])
  
def findmax2(L):
  numNeg = getNumNeg(L)
  absL = list(map(abs, L))
  if numNeg % 2 == 0:
    print(sum(absL))
  else:
    print(sum(absL)-2*min(absL))
        
n = int(input())
a = list(map(int, input().split()))
findmax2(a)
N = int(input())
A = int(input())
B = int(input())
num = []*3
for i in range(N):
    score = int(input())
    if (score <= A):
        num[0] += 1
    elif(score <= B):
        num[1] += 1
    else:
        num[2] +=1
print(min(num))


### FIXED CODE ###

N = int(input())
A,B=(int(x) for x in input().split())
scores = input().split()
num = [0,0,0]
for i in range(N):
    score = int(scores[i])
    if (score <= A):
        num[0] += 1
    elif(score <= B):
        num[1] += 1
    else:
        num[2] += 1
max_value = num[2]
for i in range(2):
    if max_value > num[i]:
        max_value = num[i]
print(max_value)
s = input()
p = s.replace('A','B')
q = p.replace('T','A')
r = q.replace('B','T')
w = r.replace('G','W')
x = w.replace('C','G')
y = x.replace('W','C')
print(y)
~


### FIXED CODE ###

s = input()
p = s.replace('A','B')
q = p.replace('T','A')
r = q.replace('B','T')
w = r.replace('G','W')
x = w.replace('C','G')
y = x.replace('W','C')
print(y)
N, M = [int(x) for x in input().split()]
g = 0

A = []
B = []

for i in range(M):
    a, b = [int(x) for x in input().split()]
    A.append(a)
    B.append(b)

A.reverse()
B.reverse()


# ----- Union Find -----------
PARENT = list(range(10 * N + 1 ))
SIZE = [1] * (10* N + 1 )

def root(n):
    if PARENT[n] == n:
        return n
    else:
        ret = root(PARENT[n])
        PARENT[n] = ret
        return ret

def same(n1, n2):
    return root(n1) == root(n2)


def unite(n1, n2):
    n1 = root(n1)
    n2 = root(n2)
    if n1 == n2:
        return
    PARENT[n1] = n2
    global g
    g = g + SIZE[n2] * SIZE[n1]
    SIZE[n2] += SIZE[n1]
    SIZE[n1] = 0

Z = N * (N - 1) // 2

ans = []
for i in range(M):
    a, b = A[i], B[i]
    unite(a, b)
    # print(PARENT[1:])
    # print(SIZE[1:])
    # print(g)
    # print(Z - g)
    ans.append(Z - g)
    # print("----")

ans.reverse()
del ans[0]
for a in ans:
    print(a)
print(Z)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N, M = [int(x) for x in input().split()]
g = 0

A = []
B = []

for i in range(M):
    a, b = [int(x) for x in input().split()]
    A.append(a)
    B.append(b)

A.reverse()
B.reverse()


# ----- Union Find -----------
PARENT = list(range( N + 1 ))
SIZE = [1] * (N + 1 )

def root(n):
    if PARENT[n] == n:
        return n
    else:
        ret = root(PARENT[n])
        PARENT[n] = ret
        return ret

def same(n1, n2):
    return root(n1) == root(n2)


def unite(n1, n2):
    n1 = root(n1)
    n2 = root(n2)
    if n1 == n2:
        return
    PARENT[n1] = n2
    global g
    g = g + SIZE[n2] * SIZE[n1]
    SIZE[n2] += SIZE[n1]
    SIZE[n1] = 0

Z = N * (N - 1) // 2

ans = []
for i in range(M):
    a, b = A[i], B[i]
    unite(a, b)
    # print(PARENT[1:])
    # print(SIZE[1:])
    # print(g)
    # print(Z - g)
    ans.append(Z - g)
    # print("----")

ans.reverse()
del ans[0]
for a in ans:
    print(a)
print(Z)
def actual(N, A):
    return max(A) - min(A)

N = int(input())
A = map(int, input().split())

print(actual(N, A))

### FIXED CODE ###

def actual(N, A):
    return max(A) - min(A)

N = int(input())
A = list(map(int, input().split()))

print(actual(N, A))
n,k = map(int,input().split())
mod = 10**9+7
anwer = 0

for i in range(k,n+1):
  max_value = sum(range(n-i+1,n+1))
  lowest_value = sum(range(1,i+1))
  answer = answer + max_value - lowest_value + 1
 
print(answer % mod)

### FIXED CODE ###

n,k = map(int,input().split())
mod = 10**9+7
answer = 0

for i in range(k,n+2):
  answer = answer + (n-i+1)*i + 1

print(answer % mod)


### FIXED CODE ###

n,x=map(int,input().split())
a=list(map(int,input().split()))
if sum(a)<x:
    a.sort(reverse=True)
else:
    a.sort()
c=0
for t in a:
    x-=t
    if x<0:break
    c+=1
if x>0:
    print(c-1)
else:
    print(c)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
tLst = [[] for _ in range(M)]
vLst = [0] * N

for i in range(M):
    a, b = map(int, input().split())
    tLst[a - 1].append(b - 1)
    tLst[b - 1].append(a - 1)

def dfs(n, index, v, ans):
    vLst[index] = 1
    if n == N - 1:
        ans += 1
        return ans
    for i in tLst[index]:
        if v == i:
            continue
        elif vLst[i] == 1:
            continue
        ans = dfs(n + 1, i, index, ans)
        vLst[i] = 0
    return ans
print(dfs(0, 0, 0, 0))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
tLst = [[] for _ in range(N)]
vLst = [0] * N

for i in range(M):
    a, b = map(int, input().split())
    tLst[a - 1].append(b - 1)
    tLst[b - 1].append(a - 1)

def dfs(n, index, v, ans):
    vLst[index] = 1
    if n == N - 1:
        ans += 1
        return ans
    for i in tLst[index]:
        if v == i:
            continue
        elif vLst[i] == 1:
            continue
        ans = dfs(n + 1, i, index, ans)
        vLst[i] = 0
    return ans
print(dfs(0, 0, 0, 0))
k, s = map(input, input().split(' '))
r = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        for z in range(0, k + 1):
            if x + y + z == s:
                r += 1
print(r)

### FIXED CODE ###

k, s = map(int, input().split(' '))
r = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        if s - x - y <= k and s - x - y >= 0:
            r += 1
print(r)
N,K = map(int,input().split()) 
numbers = list(map(int,input().split()))
num_set = set(numbers)

if len(num_set) < K:
    print(0)
else:
    numCount = []
    count = 0
    KindNum = len(num_set)
    for num_kind in num_set:
        numCount.append(numbers.count(num_kind))
    numCount.sort()
    count = sum(numCount[:KindNum - K])
print(count)



### FIXED CODE ###

import collections as c
import numpy as np

N,K = map(int,input().split()) 
A = list(map(int,input().split()))
A_c = c.Counter(A)
A_c = sorted(list(A_c.values()))
KindNum = len(A_c)
if KindNum < K:
    print(0)
else:
    ans = sum(A_c[:KindNum - K])
    print(ans)
N, K = map(int, input().split())
if K % 2:
    print(0)
elif K == 2:
    print(N-1)
else:
    print(1/0)

### FIXED CODE ###

N, K = map(int, input().split())
dp = [[[0]*N**2*3 for a in range(N+1)] for b in range(N+1)]

dp[0][0][0] = 1
for i in range(N):
    for j in range(N):
        for k in range(N**2):
            dp[i+1][j+1][k+2*j+2] += dp[i][j][k]
            dp[i+1][j][k+2*j] += dp[i][j][k] * (2*j+1)
            if j: dp[i+1][j-1][k+2*j-2] += dp[i][j][k] * j**2

print(dp[N][0][K] % (10**9+7))
n = int(input())
ns = map(input().split(), int)

c = 0
for i in range(1, n):
  if sorted([n[i-1], n[i], n[i+1]])[2] == n[i]:
    c += 1
    
print(c)

### FIXED CODE ###

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

c = 0
for i in range(1, n-1):
  if sorted([ns[i-1], ns[i], ns[i+1]])[1] == ns[i]:
    c += 1
    
print(c)
def gcd(a,b):
  if b==0:
    return a
  else:
    return(b,a%b)

n=int(input())
arr=list(map(int,input().split()))
sum1=sum(arr)
sum2=(n*(n+1))//2
cnt=sum1//sum2
if sum1%sum2!=0:
  print('NO')
else:
  s=set()
  l=n//(gcd(n,cnt))
  for val in arr:
    s.add(val%n)
  if len(s)==l:
    print('YES')
  else:
    print('NO')

### FIXED CODE ###

n=int(input())
arr=list(map(int,input().split()))
if n==1:
  print('YES')
else:
  sum1=sum(arr)
  sum2=(n*(n+1))//2
  moves=sum1//sum2
  cnt=0
  if sum1%sum2!=0:
    print('NO')
  else:
    flag=True
    arr2=[]
    for i in range(n-1):
      tmp=arr[i]+moves
      if arr[i+1]==tmp:
        continue
      else:
        diff=tmp-arr[i+1]
        if diff%n!=0:
          flag=False
        else:
          arr2.append(n-i)
          cnt+=diff//n
          tmp=arr[i+1]-diff//n
          if tmp>n*(moves-diff//n):
            flag=False
    if flag==False:
      print('NO')
    else:
      if len(arr2)==moves:
        if arr[0]==sum(arr2):
          print('YES')
        else:
          print('NO')
      elif len(arr2)>moves:
        print('NO')
      else:
        if 1*(moves-len(arr2))<=arr[0]-sum(arr2)<=n*(moves-len(arr2)):
          print('YES')
        else:
          print('NO')
#include<iostream>
    #include<vector>
    #include<algorithm>
    #define lli long long
    #define all(i) i.begin(),i.end()
    #define rall(i) i.rbegin(),i.rend()
    #define rep0(i,j) for(int i=0;i<j;i++)
    #define rep1(i,j) for(int i=1;i<=j;i++)
    #define rep0d(i,j) for(int i=j-1;i>=0;i--)
    #define MAX 1000000007
     
    using namespace std;
     
     
     
    int main() {
        lli n, mi = 1e16;
        lli min;
        cin >> n;
        vector<lli> vec(5,0);
        rep0(i,5){
            cin >> vec[i];
        
            if(vec[i]<mi){
                min = i;
                mi = vec[i];
            }
        }
        
        cout << n/vec[min] + 4 + (n%vec[min]==0)?0:1;
    }

### FIXED CODE ###

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

bt = min(a)
bt_i = a.index(bt)
t = N // bt + (0 if N % bt == 0 else 1) + 4
print(t)
N = int(input())
A = list(map(int, input().split()))
ans = 1
 
for i in range(N):
  	ans *= A[i]
	if ans > 10**18:
    	print("-1")
        break
print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
if 0 in A:
    print(0)
    exit()
ans=1
for i in A:
    ans*=i
    if ans>10**18:
        print(-1)
        exit()
print(ans)
val = input()
if val[2] == val[3] && val[4] == val[5]:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

val = input()
if val[2] == val[3] and val[4] == val[5]:
    print("Yes")
else:
    print("No")
import math
A, B = map(int, input().split())

print(int(A * B / math.gcd(A, B)))

### FIXED CODE ###

A, B = map(int, input().split())


def gcd(A, B):
    a = A
    b = B
    while b != 0:
        a, b = b, a % b
    return a


print(A * B // gcd(A, B))
from collections import deque

N=int(input())
AB=[list(map(int,input().split())) for _ in range(N-1)]
C=deque(sorted(map(int,input().split())))
edges=[[] for _ in range(N)]
for a,b in AB:
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

ps=[0]*N

def dfs(prev, curr):
    ps[curr]=C.pop()
    for dst in edges[curr]:
        if prev==dst:
            continue
        dfs(curr,dst)
dfs(-1,0)

ans=0
for a,b in AB:
    ans += min(ps[a-1],ps[b-1])

print(ans)
print(" ".join([str(p) for p in ps]))


### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(100000)

N=int(input())
AB=[list(map(int,input().split())) for _ in range(N-1)]
C=deque(sorted(map(int,input().split())))
edges=[[] for _ in range(N)]
for a,b in AB:
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

ps=[0]*N

def dfs(prev, curr):
    ps[curr]=C.pop()
    for dst in edges[curr]:
        if prev==dst:
            continue
        dfs(curr,dst)
dfs(-1,0)

ans=0
for a,b in AB:
    ans += min(ps[a-1],ps[b-1])

print(ans)
print(" ".join([str(p) for p in ps]))
n = input()
a = n % 10
if a == 3:
    print("bon")
elif a == 0 or a == 1 or a == 6 or a == 8:
    print("pon")
else:
    print("hon")

### FIXED CODE ###

n = int(input())
if n % 10 == 3:
    print("bon")
elif n % 10 == 0 or n % 10 == 1 or n % 10 == 6 or n % 10 == 8:
    print("pon")
else:
    print("hon")
A=int(input())
B=int(input())

C=A*B

if C>81:
	print(-1)
elif C<1:
	print(-1)
else:
	print(C)

### FIXED CODE ###

A,B=map(int,input().split())

if A<10 and B<10:
	print(A*B)
else:
	print(-1)