peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
from math import ceil
def myAnswer(N:int,K:int,A:list) -> int:
   if(N == K): return 1
   total = K *ceil(N/K) - ceil(N/K)
   ans = ceil(N/K)
   if(total < N):
      ans += 1
   return ans

def modelAnswer():
   return
def main():
   N,K = map(int,input().split())
   A = list(map(int,input().split()))
   print(myAnswer(N,K,A[:]))
if __name__ == '__main__':
   main()
# Judge status: Accepted
n,m=map(int,input().split())

if n %2 == 1:
    for i in range(1,m+1):
        print(i,n-i)
else:
    for i in range(m//2):
        print(n//2-i,n//2+1+i)
        print(i+1,n-i-1)
    if m%2 == 1:
        print(n//2-m//2,n//2+1+m//2)
# Judge status: Accepted
def nck(n, k):
    numer, denom = 1, 1
    for i in range(k):
        numer = numer * (n-i) % MOD
        denom = denom * (k-i) % MOD
    return numer * pow(denom, MOD-2, MOD) % MOD

x, y = map(int, input().split())
MOD = 10 ** 9 + 7

i = 2 * y - x
j = 2 * x - y
if i % 3 != 0 or j % 3 != 0 or i < 0 or j < 0:
    print(0)
else:
    i, j = i // 3, j // 3
    print(nck(i+j, min(i, j)))
# Judge status: Accepted
n,m=map(int,input().split())
mod=10**9+7
def kaijou(x):
  y=1
  for i in range(1,x+1):
    y*=i
    y%=mod
  return y
if abs(n-m)>=2:
  print(0)
elif n==m:
  print((kaijou(n)*kaijou(m)*2)%mod)
else:
  print((kaijou(n)*kaijou(m))%mod)
# Judge status: Accepted
sum = 0
for i in range(1,int(input())+1):
  sum += i
  
print(sum)
# Judge status: Wrong Answer
a=int(input())
b=int(input())
l=[1,2,3]
index_a=l.index(a)
index_b=l.index(b)
x=l.index(a,b not in l)
print(l[x])
# Judge status: Accepted
c = []
for _ in range(3):
    c.append(list(map(int, input().split())))

j1 = c[0][0] - c[0][1]
j2 = c[0][1] - c[0][2]
for i in range(1, 3):
    _j1 = c[i][0] - c[i][1]
    _j2 = c[i][1] - c[i][2]
    if j1 == _j1 and j2 == _j2:
        continue
    print("No")
    break
else:
    print("Yes")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

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

def main():
    mod=10**9+7
    N,A,B=MI()
    ans=0
    rem=N-2
    ans=rem*(B-A)+1
    ans=max(ans,0)
    if A>B or rem<0:
        ans=0
    print(ans)

main()
# Judge status: Accepted
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
ans="R"*x+"U"*y
ans+="L"*x+"D"*y
x+=1
y+=1
ans+="L"+"U"*y+"R"*x+"D"
ans+="R"+"D"*y+"L"*x+"U"
print(ans)
# Judge status: Accepted
import numpy as np

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

n = np.array(l)
n = 1000 - n
n %= 10

idx = np.argsort(n)
t = 0
for i in idx[:-1]:
    t += l[i]
    if(n[i] != 0):
        t = (t+10)-t%10
t += l[idx[-1]]
print(t)
# Judge status: Accepted
s=int(input())
L=[]
n=1
while not s in L:
  L.append(s)
  if s%2==0:
    s//=2
  else:
    s=s*3+1
  n+=1
print(n)
# Judge status: Wrong Answer
n = int(input())

colors = []

for i in range(n):
  a = int(input())
  if i == 0:
    colors.append(a)
    continue
  if a <= colors[-1]:
    colors.append(a)
  elif a > colors[0]:
    colors[0] = a
  else:
    l, r = 0, len(colors)
    while r-l > 1:
      k = (r+l)//2
      if colors[k] >= a:
        r = k
      else:
        l = k
    if colors[l] < a:
      colors[l] = a
    else:
      colors[r] = a

print(len(colors))
# Judge status: Wrong Answer
N=int(input())
S=input()
s=list()
for i in S:
  temp=ord(i)+2
  if temp<=ord("Z"):
    s.append(chr(temp))
  else:
    s.append(chr(temp-(ord("Z")-ord("A"))-1))
for i in s:
  print(i,end="")
# Judge status: Wrong Answer
a = input()
a = int(a)
c= []
for i in range(a):
  b = input()
  c.append(b)
c = list(set(c))
#print(c)
len(c)
# Judge status: Accepted
# solution
import io

n,m,k = map(int,input().split())
if 2*k >= m-n+1:
    for i in range(n,m+1):
        print(i)
else:
    for j in range(n,n+k):
        print(j)
    for p in range(m-k+1,m+1):
        print(p)
# Judge status: Accepted
N=int(input())
A=[0]*N
B=[0]*N
for i in range(N):
    A[i], B[i]=map(int, input().split())
    
A.sort()
B.sort()

if N%2==1:
    print(B[N//2]-A[N//2]+1)
else:
    print(B[N//2]+B[N//2-1]-A[N//2]-A[N//2-1]+1)
# Judge status: Accepted
from collections import deque

string = input()
x = deque()
for s in string:
    x.append(s)

head_left = True
B = int(input())
for i in range(B):
    cmd = input().split()
    if len(cmd) == 1 and cmd[0] == "1":
        head_left = not head_left
    else:
        _, n, c = cmd
        if (n == "1" and head_left) or (n == "2" and not head_left):
            x.appendleft(c)
        else:
            x.append(c)

if head_left:
    print("".join(list(x)))
else:
    print("".join(reversed(list(x))))
# Judge status: Accepted
A = list(map(int, input().split()))
if len(set(A)) == 2:
  print('Yes')
else: print('No')
# Judge status: Accepted
S = list(input())
lenS = len(S)

patternA = []
patternB = []
countA = 0
countB = 0

for x in range(lenS):
    if x % 2 == 0:
        if S[x] == "0":
            countA += 1
        else:
            countB += 1
    else:
        if S[x] == "1":
            countA += 1
        else:
            countB += 1

if countA < countB:
    print(countA)
else:
    print(countB)
# Judge status: Wrong Answer
N = int(input())

if N <= 999:
    s = 'ABC' + str(N).zfill(3)
else:
    s = 'ABD' + str(N-999).zfill(3)

print(s)
# Judge status: Wrong Answer
n=int(input("enter no"))
print(n+n*n+n*n*n)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
mod = [0]*n
check = 0
    
for ii in range(1000):
    for i in range(n):
        mod[i] = a[i] % 2
        check = check + mod[i]
        a[i] = a[i]/2
    if (check==1):
        print(ii)
        break
# Judge status: Accepted
n = int(input())
a = sorted((tuple(map(int, input().split())) for _ in range(n)), key=sum)
r = 0
p = -10**9
for x, l in a:
  if x - l >= p:
    r += 1
    p = x + l
print(r)
# Judge status: Wrong Answer
a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())

if b > a:
  if b - a <= (v-w) * t:
    print('YES')
  else :
    print('NO')

if b < a:
  if a - b <= (w-v)*t:
    print('YES')
  else:
    print('NO')
# Judge status: Accepted
n, a, b = map(int, input().split())
s = input()

ab = a + b
cnt = 0
fcnt = 1
for i in range(n):
    if s[i] == 'a' and ab > cnt:
        cnt += 1
        print('Yes')
    elif s[i] == 'b' and (ab > cnt and b >= fcnt):
        cnt += 1
        fcnt += 1
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
S = set(list(str(input())))
if len(S) == 1:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
print((b - a) * (n - 2) + 1)
# Judge status: Accepted
H_1,M_1,H_2,M_2,K=input().split()
H_1=int(H_1)
M_1=int(M_1)
H_2=int(H_2)
M_2=int(M_2)
K=int(K)
H1=H_1*60+M_1
H2=H_2*60+M_2
answer=H2-H1-K
print(answer)
# Judge status: Wrong Answer
S = input()
n = len(S)
count = 0
if(n>3):
  for i in range(n-3):
    num = int(S[i:i+4])
    if num%2019==0:
      count += 1
print(count)
# Judge status: Wrong Answer
s = input()

s = [c for c in s]

left = s[:len(s)//2]
right = s[len(s)//2+1:]

def check(s):
    left = []
    right = []

    while len(s)>1:
        left.append(s.pop(0))
        right.append(s.pop())
    
    if left==right:
        return True
    else:
        return False

if check(left)==True and check(right)==True and left==right:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a = input()

b = a[0]+a[0]+a[0]
c = a[1]+a[1]+a[1]

if (b in a) or (c in a):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N=input()
ls=list(map(int,input().split()))
ans=0
flag=0
while flag==1:
  for elem in range(N):
    if ls[elem]%2:
      ls[elem]=ls[elem]/2
    else:
      flag=1
  ans+=1
print(ans)
# Judge status: Wrong Answer
# coding: utf-8
N, K, S = map(int, input().split())
L = []
for i in range(N):
    if i < K:
        L.append(S)
    else:
        L.append(S*2)
print(*L)
# Judge status: Accepted
x=int(input())

a=x//500
b=(x%500)//5

print(a*1000 + b*5)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-k):
  print('Yes' if a[i]<a[i+k] else 'No')
# Judge status: Wrong Answer
import string
lower = string.ascii_lowercase
N_org = int(input())
N_order = 0
N=N_org
while N > 0:
    if N //len(lower) >=1:
        N = N//len(lower)
        N_order = N_order+1
    else:
        break;
S = ""
N= N_org
for i in range(N_order,0,-1):
    syou = N//(len(lower)**i)
    moji = lower[syou-1]
    N = N%(len(lower)**i)
    S = S + moji
S = S+ lower[N%len(lower)-1]

print(S)
# Judge status: Wrong Answer
n = int(input())
for i in range(1,n+1):
	cnt = 0
	for x in range(1,14):
		for y in range(1,14):
			for z in range(1,14):
				if x**2 + y**2 + z**2 + (x*(y+z)) + (y*z) == i:
					cnt += 1
	print(cnt)
# Judge status: Accepted
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

S_cnt = Counter(S)
S_key = S_cnt.keys()
T_cnt = Counter(T)

for key,v in T_cnt.items():
    if not key in S_key:
        continue
    S_cnt[key] -= v
print(max(max(S_cnt.values()), 0))
# Judge status: Accepted
date = input()
print(date.replace("2017","2018"))
# Judge status: Accepted
x = input()

a, b, c = [int(i) for i in x.split()]

print(int((a*b)/2))
# Judge status: Wrong Answer
n,m=map(int,input().split())
array=[]
cost=0
for i in range(n):
    a,b=map(int,input().split())
    array.append([a,b])
array.sort()
for i in array:
    if m<=i[1]:
        cost+=i[0]*m
    else:
        cost+=i[0]*i[1]
        m-=i[1]
        
print(cost)
# Judge status: Accepted
mod = 10**9 + 7
def cmb(n,r,mod):
	a=1
	b=1
	r = min(r,n-r)
	for i in range(r):
		a = a*(n-i)%mod
		b = b*(i+1)%mod
	return a*pow(b,mod-2,mod)%mod

X,Y = map(int,input().split())
if (X+Y)%3 != 0:
  ans = 0
else:
  n = (2*X-Y)//3
  m = (2*Y-X)//3
  if n < 0 or m < 0:
    ans = 0
  else:
    ans = cmb(n+m,m,mod)
print(ans)
# Judge status: Accepted
from math import gcd
N = int(input())
A = list(map(int, input().split()))
g = A[0]
for i in range(1, N):
  g = gcd(g, A[i])
ans = 0
while g % 2 == 0:
  g //= 2
  ans += 1
print(ans)
# Judge status: Accepted
x, y = map(int, input().split())
ans = []
if y-x>=0:
    ans.append(y-x)
if -y-x>=0:
    ans.append(-y-x+1)
if y+x>=0:
    ans.append(y+x+1)
if -y+x>=0:
    ans.append(-y+x+2)
print(min(ans))
# Judge status: Accepted
X, Y, Z = map(int, input().split())
print((X-Z)//(Y+Z))
# Judge status: Wrong Answer
N = input()
if "9" in "N":
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
money = 1000
num = 0
flag = False
a.append(a[n - 1])
for i in range(n):
    #print(num, money)
    if a[i] < a[i + 1]:
        num += money // a[i]
        money -= a[i] * num
        money += num * a[i + 1]
        num = 0
print(money)
# Judge status: Accepted
N = int(input())

INF = 10 ** 9


def base(x, y):
    ret = 0
    while x >= y:
        ret += x % y
        x //= y
    ret += x
    return ret
        

def main():
    ans = INF
    for i in range(N + 1):
        v = base(i, 6) + base(N - i, 9)
        ans = min(ans, v)
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
A=list(map(int,input().split()))

list=[0]*101
#A~B秒までの要素を+1
for i in range(A[0],A[1]+1):
  list[i]+=1
for i in range(A[2],A[3]+1):
  list[i]+=1

print(list.count(2))
# Judge status: Wrong Answer
N = int(input())
v = sorted(list(map(int,input().split())))
ans = []
#print((sum(v[:-1])/(N-1)+v[-1])/2)

for i in range(1,N):
    v[i-1]=(v[i-1]+v[i])/2
print(min(v))
# Judge status: Accepted
S = input()
K = int(input())

for i, s in enumerate(S):
    if s != '1':
        print(s)
        break
    if i + 1 == K:
        print('1')
        break
# Judge status: Accepted
k,a,b = map(int,input().split())
if b<=a+1:
    print(1+k)
else:
    n = (k-a+1)//2
    m = (k-a+1)%2
    print(n*(b-a)+m+a)
# Judge status: Accepted
x=int(input())
a=x//11
p,q=divmod(x,11)
if q==0:
  print(p*2)
elif q<=6:
  print(p*2+1)
else:
  print(p*2+2)
# Judge status: Wrong Answer
n = int(input())

a = n // 4
b = n // 7
count = 0

for i in range(a):
    n = n - i * 4
    for j in range(b):
        if n % 7 == 0:
            print("Yes")
            count += 1
            break
        else:
            pass

if count == 0:
    print("No")
else:
    pass
# Judge status: Accepted
N, M = map(int, input().split())

if N > M:
    N, M = M, N

if N == 1:
    if M == 1:
        print(1)
        exit()
    else:
        M -= 2
else:
    N -= 2
    M -= 2

print(N * M)
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7


def comb(n, r):
    res = 1
    for i in range(1, r+1):
        res = res*(n-i+1) % mod
        res = res*pow(i, mod-2, mod) % mod
    return res


ans = (pow(2, n, mod)-1) - comb(n, a) % mod - comb(n, b) % mod
print(ans)
# Judge status: Accepted
H1, M1, H2, M2, K = map(int,input().split())
T = (H2 - H1)*60 + (M2 - M1) - K
if T <= 0:
  print(0)
else:
  print(T)
# Judge status: Wrong Answer
X,Y=map(int,input().split())

a = 2*X -Y/2
b = Y/2 - X

if ((a+b) == X) and ((2*a+4*b) == Y):
    print('Yes')
elif ((a+b) not in X) and ((2*a+4*b) not in Y):
    print('No')
# Judge status: Wrong Answer
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = [i for i in input()]
x = T[0]
ans = 0
for i in range(1,N):
    y = T[i]
    if x != y:
        if y == "s":
            ans += R
        elif y == "p":
            ans += S
        else:
            ans += P
    x = y
    #print(ans,i)
print(ans)
# Judge status: Accepted
n = int(input())
tmp = n
ans = ""

i = 1

while n > 0:
    n -= 1
    r = n % 26
    ans += chr(ord("a") + r)

    n = n // 26

print(ans[::-1])
# Judge status: Accepted
import math
pi=math.pi
def rtod(rad):
    return 180/pi*rad
a,b,x=map(int,input().split())


if b/2<x/a**2:
    ans=2*(a**2*b-x)/a**3
    ans=math.atan(ans)
    print(rtod(ans))
else:
    ans=b**2/(2*x)*a
    ans=math.atan(ans)
    print(rtod(ans))
# Judge status: Wrong Answer
li = input().split()

print(li.count("1"))
# Judge status: Accepted
n,m = map(int,input().split())
ans = [0]*100
for i in range(m):
    a,b = map(int,input().split())
    ans[a-1] += 1
    ans[b-1] += 1
for i in range(n):
    print(ans[i])
# Judge status: Accepted
N = int(input())
inp = 'a'

def AAA(arr):
    if len(arr) < N:
        for i in range(ord(max(arr))-96+1):
            AAA(arr+chr(i+1+96))
    else:
        print(arr)


AAA(inp)
# Judge status: Wrong Answer
N = str(input())
c = []
for i in range(0,len(N)-1):
    if i % 2 == 0:
        if N[i] == 'R' or N[i] == 'U' or N[i] == 'D':
            c.append(N[i])
    else:
        if N[i] =='L' or N[i] == 'U' or N[i] == 'D':
            c.append(N[i])



if len(c) == len(N):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import bisect
import math

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

As.sort()
a = As[-1]
j = bisect.bisect_left(As, a/2)

if j == 0 or a - As[j] > As[j-1]:
  print("{} {}".format(a, As[j]))
else:
  print("{} {}".format(a, As[j-1]))
# Judge status: Wrong Answer
S = input()

l = len(S)
K = ""
for i in range(l):
  K += "x"
  
print(K)
# Judge status: Accepted
N=int(input())%1000

if N==0:
  print(0)
else:
  print(1000-N)
# Judge status: Accepted
n = int(input())
s = input()

r = g = b = 0
for i in s:
    if i == "R":
        r += 1
    elif i == "G":
        g += 1
    elif i == "B":
        b += 1
ans = r * g * b

for i in range(n-2):
    si = s[i]
    for j in range(i+1, i+(n-i-1)//2+1):
        sj = s[j]
        k = 2*j-i
        if k < n and s[k] != si and s[k] != sj and si != sj:
            ans -= 1

print(ans)
# Judge status: Accepted
r=  int(input())
print(r**2)
# Judge status: Accepted
from itertools import product

ABCD = input()

for op in product(("+", "-"), repeat=3):
    ans = ""
    for i in range(len(ABCD)-1):
        ans += ABCD[i] + op[i]
    ans += ABCD[-1]
    if eval(ans) == 7:
        print(ans+"=7")
        exit()
# Judge status: Accepted
K = int(input())
A, B = map(int, input().split())

flg = False
for i in range(A, B+1):
    if i % K == 0:
        flg = True
        break
if flg:
    print('OK')
else:
    print('NG')
# Judge status: Accepted
a,b,x=map(int,input().split())
num_a=a//x
num_b=b//x
ans=num_b-num_a
if a%x==0:
    ans+=1
print(ans)
# Judge status: Accepted
s = input()
ss = s[:len(s) // 2]

ans = "Yes"
if s != s[::-1] or ss != ss[::-1]: ans = "No"

print(ans)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
l = len(a)
a.sort(reverse=True)
ans = 0
cnt = 0
for i in range(1,l,2):
  ans += a[i]
  cnt += 1
  if cnt == N: break
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
s=input()
flag1=True
if s[a]!='-':
    flag1=False
flag2=True
for i in range(0,len(s)):
    if i==a:
        continue
    if not (s[i]>='0' and s[i]<='9'):
        flag2=False
print('Yes') if flag1 and flag2 else print('No')
# Judge status: Wrong Answer
import math
x,y = map(int ,input().split())
m = math.ceil(math.log(x, y))
print(m)
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
c = list(map(int, input().split()))
for _ in range(n):
    s = list(map(int, input().split()))
    a = max(enumerate(s), key=lambda x: x[1])[0] + 1
    print(a)
# Judge status: Wrong Answer
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


n, m = map(int, input().split())
s = set(range(1, m+1))
# print(s)
for i in range(n):
    a = list(map(int, input().split()))
    a_set = set(a[1:])
    # print(a_set)
    s &= a_set
    # print(s)
    print(len(s))
# Judge status: Accepted
import bisect

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in b:
  p = bisect.bisect_left(a, i)
  q = bisect.bisect_right(c, i)
  ans += (p*(n-q))
  
print(ans)
# Judge status: Accepted
N=int(input())
t=[0]*100003
x=[0]*100003
y=[0]*100003

for i in range(1,N+1):
    t[i],x[i],y[i]=map(int, input().split())
count=0

for i in range(1,N+1):
    dt=t[i]-t[i-1]
    dist=abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    if dist>dt:
        break
    else:
        pass
    if dist%2==dt%2:
        pass
    else:
        break
    count+=1
if count==N:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a,b = map(int, input().split())

print(a if a<= b else a-1)
# Judge status: Accepted
# -*- coding: utf-8 -*-
x, a, b = map(int, input().split())
print('BA'[abs(a - x) < abs(b - x)])
# Judge status: Accepted
import sys

x = int(input())

for i in range(-118, 120):
    for j in range(-119, 119):
        if i**5 - j**5 == x:
            print(i, j)
            sys.exit()
# Judge status: Accepted
O=input()
E=input()
for i in range(len(O)*2-1 if len(O)!=len(E) else len(O)*2):
    if i%2==0:
        print(O[i//2],end="")
    else:
        print(E[i//2],end="")
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())
left = k

while a >= b:
    left -= 1
    b *= 2

while b >= c:
    left -= 1
    c *= 2

if left >= 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
for i in range(1000):
  if n % 111 == 0:
    print(n)
    exit()
  n += 1
# Judge status: Accepted
def INT():
    return int(input())

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

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

N = INT()
T, A = MI()
H = list(map(lambda x : T - 0.006 * int(x), input().split()))

for i in range(N):
    H[i] = abs(H[i] - A)
    
ans = H.index(min(H)) + 1

print(ans)
# Judge status: Accepted
N = int(input())
def fac(N):
    if N == 1:
        return [['a']]
    li = []
    for x in fac(N-1):
        n = len(set(x))
        for i in range(n+1):
            li.append(x+[chr(97+i)])
    return li
for x in fac(N):
    print(''.join(x))
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
print('Yes' if 2*(A+B) >= C else 'No')
# Judge status: Wrong Answer
import sys
a, b, c, d = map(int, sys.stdin.readline().split())
if a+b <= d:
  print(a-d+a+b)
else:
  print(a)
# Judge status: Wrong Answer
S=input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
  print("Bad")
else:
  print("Yes")
# Judge status: Accepted
n = int(input())
S = [int(input()) for i in range(n)]

ans = sum(S)
sort_S = sorted(S)
if ans % 10 != 0:
    print(ans)
    exit()
else:
    for s in sort_S:
        if s % 10 != 0:
            ans -= s
            print(ans)
            exit()
print(0)
# Judge status: Accepted
def Divisors(n):
    L=[]
    k=1
    while k*k <= n:
        if n%k== 0:
            L.append(k)
        k+=1
    return L

N=int(input())
T=Divisors(N)

M=10**20
for a in T:
    M=min(M,a+(N//a)-2)
print(M)
# Judge status: Accepted
a = str(input())
b = ord(a)
print(chr(b+1))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

s = "APPRPVED"

for i in A:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            s = "DENIED"

print(s)
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N <= K:
    print(N*X)
else:
    print(K*X+(N-K)*Y)
# Judge status: Accepted
import math
A,B = map(int,input().split())
ans = 0
while 1:
    C = math.floor(ans*0.08)
    D = math.floor(ans*0.1)
    if C == A and D == B:
        print(ans)
        break
    if C > A or D > B:
        print(-1)
        break
    ans += 1
# Judge status: Accepted
S = input()

if S[0] == S[1] or S[1] == S[2] or S[2] == S[0]:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
n,h=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(n)]

attack=max(AB)[0]
AB=sorted(AB, reverse=True, key=lambda x:x[1])
cnt=0
for i,j in AB:
    if j>=attack:
        h -=j
        cnt +=1
    if h<=0:print(cnt);exit()

print(cnt+h//attack if h%attack==0 else cnt+h//attack+1)
# Judge status: Wrong Answer
a,b = map(int,input().split())

if a < 8 and b < 8:
    print('Yey!')
else:
    print(':(')
# Judge status: Accepted
S = str(input())

if S[1] == 'B':
    print ('ARC')
else:
    print ('ABC')
# Judge status: Accepted
x=int(input())
t=0
i=1
while True:
    t+=x
    t%=360
    if t==0:
        print(i)
        break
    i+=1
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
Alice = 0
Bob = 0
for i in range(n):
    if i % 2 == 0:
        Alice += a[i]
    else:
        Bob += a[i]
print(Alice-Bob)
# Judge status: Accepted
def resolve():
    x, a, b = map(int, input().split())

    ans = str()
    if a >= b:
        ans = "delicious"
    elif a+x >= b:
        ans = "safe"
    elif a+x < b:
        ans = "dangerous"
    print(ans)
resolve()
# Judge status: Wrong Answer
n, k, s = map(int, input().split())
Ans = [s]*k
for i in range(n-k):
  Ans.append(s+1)

L=[str(a) for a in Ans]
L=" ".join(L)
print(L)
# Judge status: Accepted
n = int(input())
m = list(map(int,input().split()))
k = 0
for i in m:
  k ^= i
l = []
for i in m:
  l.append(k ^ i)
print(*l)
# Judge status: Accepted
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#from itertools import groupby as gb
#from itertools import permutations as perm
#from itertools import combinations as comb
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
#n,m = map(int, stdin.readline().rstrip().split())
#AB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
ans = 800*n - (n//15)*200
print(ans)
# Judge status: Accepted
x = int(input())
ans = 0;
now = 100
while now < x:
	now *= 101
	now //= 100
	ans += 1
print(ans)
# Judge status: Wrong Answer
N, X = map(int, input().split(' '))
L = list(map(int, input().split(' ')))
D = [0 for _ in range(N + 1)]
for i in range(1, N + 1):
  D[i] = D[i-1] + L[i-1]
  if D[i] > X:
    break
print(i)