peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a = [int(input()) for _ in range(5)]
k = int(input())

for i in range(len(a)-1):
    for j in range(i+1, len(a)):
        if a[j] - a[i] > k:
            print(':(')
            exit()

print('Yay!')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

able = True
count = 0
if A[0] > 1:
  able = False
else:
  bb = 1-A[0]
  count += 1
  for a in A[1:]:
    print(count)
    b = 2*bb - a
    if 0 <= b and b <= 2*bb:
      count += 2*bb
      bb = b
    else:
      able = False
      break
if able:
  print(count)
else:
  print(-1)
# Judge status: Accepted
n = list(map(int, input().split()))
n.sort()
print(n[0] + n[1])
# Judge status: Accepted
n = int(input())

def d(k):
    s = 0
    while k > 0:
        k //= 10
        s += 1
    return s

dn = d(n)
a = 0
for i in range(1, dn + 1):
    if i % 2 == 1:
        if n < 10 ** i:
            a += n - 10**(i- 1) + 1
        else:
            a += 10 ** i - 10 ** (i - 1)
print(a)
# Judge status: Accepted
#!/usr/bin/env python3

def solve(x):
    if x == 1:
        return 1
    f = 2
    l = [1]
    while f * f <= x:
        d = f
        while d <= x:
            l.append(d)
            d *= f
        f += 1
    return max(l)



def main():
    X = int(input())
    print(solve(X))
    return

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))
l.sort()
if l[-1] < sum(l[:-1]):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import math
a,b,x = map(int,input().split())
S = a*a*b
if 2*x>=S:
    tmp = 2 * (S - x) / (a**3)
else:
    tmp = a * b * b / (2 * x)
print(math.degrees(math.atan(tmp)))
# Judge status: Wrong Answer
x = 5
y = 10
temp = x
x = y
y = temp
print('The value of x after swapping: {}'.format(x))
print('The value of y after swapping: {}'.format(y))
# Judge status: Accepted
import bisect

n,m=map(int,input().split())

x=[list(map(int,input().split())) for i in range(m)]

lst=[[] for i in range(n)]

for i,v in x:
    lst[i-1].append(v)

for i in range(n):
    lst[i].sort()

for i,v in x:
    z=bisect.bisect_left(lst[i-1],v)+1

    print('0'*(6-len(str(i)))+str(i)+'0'*(6-len(str(z)))+str(z))
# Judge status: Wrong Answer
N = input()
if N in "9":
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s=sorted(list(input()))
t=sorted(list(input()),reverse=True)

if s<t:
    print("Yes")
else:
    print("No")
# Judge status: Accepted

url = "https://atcoder.jp//contests/abc098/tasks/arc098_a"

def main():
    input()
    s = input()
    w_count = s.count('W')
    right_we = {"W": w_count, "E": len(s) - w_count}
    left_we = {"W": 0, "E": 0}
    ans = 10000000
    for v in s:
        right_we[v] -= 1
        ans = min(ans, right_we["E"] + left_we["W"])
        left_we[v] += 1
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
ans='None'
for i in range(26):
  s = chr(ord('a') + i)
  if s not in S:
    ans = s
    break
print(ans)

#print(*ans, sep='\n')
# Judge status: Wrong Answer
n = int(input())
m = sum(range(1,n+1)) #1~nまでの総和を出している#
s = 0
g = 0
i = 0


while i <= n:
    i += 3
    s += i
    
s -= i
i =0

while i <= n:
    i += 5
    if (i % 3) != 0: 
        g += i

g -= i
print(int(m)-int(s)-int(g))
# Judge status: Accepted
import sys 

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


c = N - M + 1

for ic in range(c):
    for jc in range(c):
        cnt = 0
        for i in range(M):
            for j in range(M):
                if A[ic + i][jc + j] == B[i][j]:
                    cnt += 1

        if cnt == M * M:
            print("Yes")
            sys.exit()
else:
    print("No")
# Judge status: Accepted
import collections

N, K = map(int, input().split())
A = sorted(collections.Counter(list(map(int, input().split()))).items(), key=lambda x: x[1], reverse = True)
if len(A) <= K:
    print(0)
else:
    print(sum([x[1] for x in A[K:]]))
# Judge status: Wrong Answer
import heapq

def solve(n, a):
    a = sorted(a, reverse=True)
    ans = sum(a[:2])
    que = [(a[-2], a[-1])]
    heapq.heapify(que)
    for i in range(2, n):
        x, y = heapq.heappop(que)
        ans += min(x, y)
        heapq.heappush(que, (a[i], x))
        heapq.heappush(que, (a[i], y))
    return ans

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))
# Judge status: Accepted
a, b, c = map(int, input().split())
motigane = a + b
if motigane >= c:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
o = str(input())
e = str(input())
print(*[a + b for a, b in zip(o, e)], sep="")
# Judge status: Accepted
N,L = map(int,input().split())
S = [input() for i in range(N)]
S = sorted(S)
for n in range(N):
  tmp = S.pop(0)
  print(tmp,end = "")
# Judge status: Accepted
n,k,x,y=(int(input()) for i in range(4))
print(n*x-(x-y)*max(n-k, 0))
# Judge status: Wrong Answer
n=int(input())
s=input()
if n==0 or n==1:
    print("No")
    exit()
a=s[0:len(s)//2] 
b=s[len(s)//2 if len(s)%2 == 0 else ((len(s)//2)+1):]

if a==b:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys

N, K = map(int, input().split())
arr = []
su = 0
for n in range(N):
  a, b = map(int, input().split())
  su += b
  if su >= K:
    print(a)
    sys.exit()
# Judge status: Accepted
a, b, m = map(int, input().split())

aa = list(map(int, input().split()))
bb = list(map(int, input().split()))

mm = list()
for ii in range(0,m):
    mm.append(list(map(int, input().split())))

prices = list()

prices.append(int(min(aa)) + int(min(bb)))

for ml in mm:
    prices.append(aa[ml[0]-1] + bb[ml[1]-1] - ml[2])

print(min(prices))
# Judge status: Accepted
s, t = input().split(" ")
a, b = (int(x) for x in input().split(" "))
u = input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)
# Judge status: Wrong Answer
import math
N = int(input())
a = 1
b = 1
ran = int(math.floor(math.sqrt(N)))
m = 1
for i in range(1,ran):
    if N%i == 0:
        if i > m:
            m = i
print(m + N/m -2)
# Judge status: Wrong Answer
# coding: utf-8
# Your code here!
import sys
s = str(input())

ch = s[0]+s[2]

test_st = s[1]+s[3:]
#print(test_st)
if ch == 'AC' and 'C' not in test_st:
    print('AC')
else:
    print('WA')
# Judge status: Accepted
A, B = map(int, input().split())

s = A
while s % B != 0:
    s += A
print(s)
# Judge status: Accepted
n,m = map(int, input().split())
H = list(map(int, input().split()))
d = {i:[] for i in range(1, n+1)}

for _ in range(m):
  a,b = map(int, input().split())
  d[a].append(b)
  d[b].append(a)
  
count = 0  
  
for k,v in d.items():
  if not v:
    count += 1
  else:
    flg = True
    for v_i in v:
      if H[k-1]<=H[v_i-1]:
        flg = False
        break
    if flg:
      count += 1
    
print(count)
# Judge status: Accepted
import numpy as np
n = int(input())
a = np.array(list(map(int,input().split())))
bit = []
ans = 0
mod = 10**9+7
for i in range(60):
    bit.append(np.count_nonzero(a&1))
    a >>= 1
for i in range(60):
    ans += ((n-bit[i])*bit[i]) * pow(2,i,mod)
    ans %= mod
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
L = [list(map(int,input().split())) for _ in range(n)]
L = sorted(L, key=lambda x: x[0])
limit = m
ans = 0
for i in range(n):
  if limit <= 0: break
  ans += min(limit, L[i][1]) * L[i][0]
  limit -= L[i][1]
print(ans)
# Judge status: Wrong Answer
import math
x = input()
if len(x) > 3:
    y = int(x)/100
    y = math.floor(y)
    a = (y * 200) + (int(x[-2])*10)
    print(a)
elif len(x) == 1:
    print(0)
# Judge status: Accepted
w,h,n=map(int,input().split())
l,r=0,w
d,u=0,h
for i in range(n):
    x,y,a=map(int,input().split())
    if a==2:
        r=min(r,x)
    elif a==1:
        l=max(l,x)
    elif a==4:
        u=min(u,y)
    else:
        d=max(d,y)
print(0 if r<=l or u<=d else (r-l)*(u-d))
# Judge status: Accepted
n,a,b  = map(int,input().split())
if a > b:ans = 0
elif n == 1:
    if a == b:ans = 1
    else:ans = 0
else:
    ans = (b-a)*(n-2)+1
print(ans)
# Judge status: Accepted
import sys

x = int(sys.stdin.readline().rstrip())

def main():
    n = int((x * 2) ** 0.5)
    res = n if (1 + n) * n // 2 >= x else n + 1
    print(res)

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

x = int(input())

t = (-1 + np.sqrt(1 + 8 * x)) // 2
t = int(t)

print(t + 1)
# Judge status: Accepted
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
        break
    else:
        cost+=i[0]*i[1]
        m-=i[1]
        
print(cost)
# Judge status: Wrong Answer
n,m=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(m)]
count=[1]*(n+1)
s=set()
s.add(1)
for a,b in arr:
  if a in s:
    s.add(b)
    count[b]+=1
    count[a]-=1
  if count[a]==0:
    s.discard(a)
print(len(s))
# Judge status: Wrong Answer
n,k=map(int,input().split())
c=[]
d=[]
co=0
wr=0
for i in range(k):
    a,b=map(str,input().split())
    c.append(int(a))
    if b=='AC':
        d.append(a)
        co+=1
    if b=='WA' and a not in d:
        wr+=1
print(co,wr)
# Judge status: Wrong Answer
s=input()
l=len(s)
ans=0
for i in range(l):
  if s[i] in ['A','T','G','C']:
    ans+=1
print(ans)
# Judge status: Accepted
def main():
    a, b, c = map(int, input().split())
    if a%2 == 1 or b%2 == 1 or c%2 == 1:
        print("0")
    else:
        if a == b == c:
            print("-1")
        else:
            ans = 0
            while a%2 == 0 and b%2 == 0 and c%2 == 0:
                a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
                ans += 1
            print(ans)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
s = input()

ans = "Yes" if (n & 1) and s[0:int(n / 2)] == s[int(n / 2):n] else "No"
print(ans)
# Judge status: Wrong Answer
n=input()
a=int(n[0:2])
b=int(n[2:4])
if a<13 and b<13:
    print('AMBIGUOUS')
elif a>0 and a<13:
    print('MMYY')
elif 0<b and b<13:
    print('YYMM')
else:
    print('NA')
# Judge status: Accepted
N = int(input())
a = sorted(list(map(int, input().split())),reverse=True)
A = 0
for i in range(1, 2 * N, 2):
    A += a[i]
print(A)
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=[int(x) for x in input().rstrip().split()]

l=[0 for i in range(n)]
cnt=0

dist=[]
now=0
while(True):
  
  if l[now]+1==3:
    break
  dist.append(now)

  l[now]+=1
  now=a[now]-1


k=k-l.count(1)
g=l.count(2)
# print(dist)
# print(l)


dist=dist[l.count(1):]

print(dist[k%g]+1)
# Judge status: Accepted
import math;

n,x,t=list(map(int,input().split()))
print(math.ceil(n/x)*t)
# Judge status: Accepted
n=input()
if '9' in n:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from collections import Counter
s=Counter(input()).most_common()
t=Counter(input()).most_common()
ans="Yes"
for i in range(min(len(s),len(t))):
  if s[i][1]!=t[i][1]:
    ans="No"
print(ans)
# Judge status: Accepted
n=int(input())
h=list(map(int,input().split()))
a=0
b=[]
for i in range(n-1):
    if h[i] >= h[i+1]:
        a+=1
    else:
        b.append(a)
        a=0
b.append(a)
print(max(b))
# Judge status: Wrong Answer
a = input()
b = input()

b_reverse = a[::-1]

if a == b_reverse:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
s = sum(a)
x = 0
m = s
for i in range(n):
    x += a[i]
    m = min(m, abs(s-x*2))
print(m)
# Judge status: Accepted
n, m = map(int, input().split())
aaa = [0] * (n + 1)
for _ in range(m):
    aaa[int(input())] = 1
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 0 if aaa[1] == 1 else 1
for i in range(2, n + 1):
    if aaa[i] == 1:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]

print(dp[n] % 1000000007)
# Judge status: Accepted
s = str(input())
for i in range(len(s)):
    print("x",end = '')
# Judge status: Accepted
def main():
    n = int(input())
    m = 100 // 7 + 1
    flag = False
    for i in range(m):
        for j in range(m):
            if n == i * 7 + j * 4:
                flag = True
                if flag:
                    print('Yes')
                    break
        else:
            continue
        break
    if not flag:
        print('No')
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
N=int(input())
a=N//1.08
c=a+1
d=a-1
b=a*1.08
b=int(b)
if b==N:
  print(a)
  sys.exit()
elif int(c*1.08)==N:
  print(c)
elif int(d*1.08)==N:
  print(d)
# Judge status: Accepted
n,c,k=map(int,input().split())
t=[int(input()) for _ in range(n)]
t.sort()
cnt,now=0,0
while now<n:
    temp=t[now]+k
    a=now
    for i in range(c-1):
        if i+1+a>=n:
            break
        if t[i+1+a]>temp:
            break
        now+=1
    now+=1
    cnt+=1
print(cnt)
# Judge status: Wrong Answer
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

x = [0] * M
y = [0] * M
c = [0] * M

min = 99999999

for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())
    cost = a[x[i] - 1] + b[y[i] - 1] - c[i]
    if cost < min:
        min = cost

min = 99999999

for i in range(A):
    for j in range(B):
        cost = a[i] + b[j]
        if cost < min:
            min = cost

print(min)
# Judge status: Accepted
n = int(input())

for i in range(n, 1001):
    if i % 111 == 0:
        ans = i
        break
print(ans)
# Judge status: Accepted
# coding: utf-8
# Your code here!
N,M=map(int,input().split())

shop=[]

for _ in range(N):
    A,B=map(int,input().split())
    shop.append([A,B])

shop.sort(key=lambda x:x[0])

ans=0
for money, num in shop:
    if M<=num:
        ans+=money*M
        break
    else:
        ans+=money*num
        M-=num

print(ans)
# Judge status: Wrong Answer
N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    p=i
    c=0
    while p<=K:
        p*=2
        c+=1
    ans+=1/2**c
print(ans/N)
# Judge status: Wrong Answer
n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
m = max(l)
ans = [m]*n
if len(set(l)) == 1:
    [print(i) for i in ans]
else:
    x = sorted(set(l))[-2]
    a = [index for index, value in enumerate(l) if value == m]
    for i in a:
        ans[i] = x
    [print(i) for i in ans]
# Judge status: Accepted
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(input())
    a = list(map(int, readline().split()))

    from collections import Counter

    counter = Counter(a)
    ans = 0

    for num, cnt in counter.items():
        if cnt > num:
            ans += (cnt-num)
        if cnt < num:
            ans += cnt

    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
def solve():
    N = int(input())
    if N % 2 == 0:
        return 0.5
    return ((N+1) // 2) / N

print(solve())
# Judge status: Wrong Answer
s = input()
n = len(s)
t = s[:n // 2]
k = s[-n//2+1:]
if s == s[::-1] and t == t[::-1]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
l = [int(input()) for _ in range(n)]
m = [int(__) for __ in range(1,n+1)]

x = l[0]
y = 1
for i in range(10**5):
    y += 1
    z = m.index(x)
    if l[z] == 2:
        break
    else:
        x = l[z]

if y == 100001:
    print('-1')
else:
    print(y)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
find_num = 1
break_num = 0
for i in range(n):
    if a[i] == find_num:
        find_num += 1
    else:
        break_num += 1
if break_num == n:
    print(-1)
else:
    print(break_num)
# Judge status: Accepted
x,y=map(int,input().split())

if (x*2) <= y <= (x*4) and y%2 ==0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
s = input()
s = s.replace("erase", "")
s = s.replace("eraser", "")
s = s.replace("dreamer", "")
s = s.replace("dream", "")
if len(s) == 0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a.sort()

n_max = 10**6+1

ans = 0
flag = [True] * (n_max)
for i in range(n-1):
    if(not flag[a[i]]):
        continue

    if(a[i]!=a[i+1]):
        ans += 1
    for j in range(a[i],n_max,a[i]):
        flag[j] = False

ans += flag[a[-1]]*1
print(ans)
# Judge status: Accepted
rli,cli=list(input()),list(input())
if rli[0]==cli[2] and rli[1]==cli[1] and rli[2]==cli[0]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h.sort()
ans = max(h)
for i in range(N-K+1):
    if h[i+K-1]-h[i] < ans:
        ans = h[i+K-1]-h[i]
print(ans)
# Judge status: Wrong Answer
n = list(input())
x = 0
y = 1
for i in n:
    if y < 4:
        if i == n[y]:
            x += 1
            y += 1
        else:
            x += 0
            y += 1
if x >= 2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())

s = 0

i = 1
while s <= N:
    s += i
    i += 1

l = list(range(1, i))
del l[l.index(s-N)]
print(*l)
# Judge status: Wrong Answer
n= int(input())
w=[list(input()) for i in range(n)]
cnt=0
for k in range(n-1):
  if w[[k][-1]] == w[[k+1][0]] and len(w) == len(set(w)):
    cnt+=1
    
if cnt==n-1:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n, *a = map(int, open(0).read().split())
a.sort()
x, y = a[0], a[1]
while y%x:
        y -= y//x*x
        x, y = y, x
print(x)
# Judge status: Wrong Answer
n = int(input())
pl = list(map(int, input().split()))

dic = {}
for i in range(1, n+1):
    dic.setdefault(i, 0)

for i in range(n-2):
    tmp = sorted(pl[i:i+3])
    if tmp[0] < tmp[1] < tmp[2]:
        dic[tmp[1]] += 1

count = 0
for v in dic.values():
    if v > 0:
        count += 1

print(count)
# Judge status: Wrong Answer
array = list(map(int, input().split()))
array.sort
print(sum(array[0:2]))
# Judge status: Accepted
from decimal import Decimal
a,b = input().split()
print(int(Decimal(a)*Decimal(b)))
# Judge status: Accepted
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
# import math
from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

s = input()
print(s[:3])
# Judge status: Accepted
N = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(len(p)):
    if i + 1 == p[i]:
        if i + 1 != len(p):
            tmp = p[i]
            p[i] = p[i + 1]
            p[i + 1] = tmp
            count += 1
        else:
            tmp = p[i]
            p[i] = p[i - 1]
            p[i - 1] = tmp
            count += 1

print(count)
# Judge status: Accepted
a,b,c= map(int,input().split())
cnt = 0
if a == b and b == c:
    if a%2 == 0 and b%2 == 0 and c%2 == 0:
        print(-1)
        exit()
    else:
        print(0)
        exit()
while a%2 == 0 and b%2 == 0 and c%2 == 0:
    cnt +=1
    x =(b+c)//2
    y =(c+a)//2
    z =(b+a)//2
    a = x
    b = y
    c = z
print(cnt)
# Judge status: Accepted
N,M= map(int, input().split())

num = list(range(1,N+1))
ans = []


if M % 2 == 0:
    for i in range(M // 2):
        ans.append([i+1,M+1-i])
    for i in range(M // 2):
        ans.append([i+2+M,2*M+1-i])


if M % 2 != 0:
    for i in range(M // 2):
        ans.append([i+1,M-i])
    for i in range(M - M//2):
        ans.append([i+1+M,2*M+1-i])


for an in ans:
    print(an[0],an[1])
# Judge status: Wrong Answer
N = input()
ndig = len(N)
print(int(N[0]) - 1 + 9 * (ndig - 1))
# Judge status: Wrong Answer
S = input()
if 'N' in S and 'W' in S and 'S' in S and 'E' in S:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import numpy as np
nmq = input()
[n, m, q] = [int(comp) for comp in nmq.split()]
abcd = []
for i in range(q):
  temp = input()
  abcd.append([int(comp) for comp in temp.split()])
a = np.ones(n, dtype=int)
maxi = 0


def search(i, mini):
  global maxi
  global a
  if(i == n):
    temp = np.array([comp[3] for comp in abcd if (
        a[comp[1] - 1] - a[comp[0] - 1] == comp[2])]).sum()
    maxi = max(temp, maxi)
    return 0
  for j in range(mini, 11):
    a[i] = j
    search(i + 1, j)


search(0, 1)
print(maxi)
# Judge status: Accepted
S = input()
curr = ""
last = ""
cnt = 0
for c in S:
    curr += c
    if curr != last:
        last = curr
        curr = ""
        cnt += 1
print(cnt)
# Judge status: Accepted
n = int(input())
s = input()
d = {'R':0,'G':0,'B':0}
for c in s:
    d[c]+=1
all = d['R']*d['G']*d['B']
cnt = 0
for i in range(n):
    for j in range(i+1, n+1):
        k = (j*2)-i
        if k >= n:
            continue
        if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
            cnt += 1
print(all-cnt)
# Judge status: Accepted
n = int(input())
x = 0
mn = 100
for i in range(n):
  s = int(input())
  x += s
  if s % 10 != 0:
    if s <= mn:
      mn = s
if x % 10 != 0:
  print(x)
else:
  x -= mn
  if x % 10 == 0:
    print(0)
  else:
    if x < 0:
      print(0)
      exit()
    print(x)
# Judge status: Wrong Answer
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

stk = []
ret = 0

for item in a:
    while stk and stk[-1] < item:
        stk.pop()
    stk.append(item)
    if len(stk) > ret:
        ret = len(stk)

print(ret)
# Judge status: Accepted
import sys
from itertools import groupby
def input(): return sys.stdin.readline().rstrip()

def main():
    n,k=map(int, input().split())
    S=list(input())
    p=len(list(groupby(S)))-2*k 
    pp=max(p,1)
    print(n-pp)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
D = list(map(int, input().split()))
D.sort()
if D.pop(0) != 0:
  ans = 0
else:
  ans = 1
  num = 1
  before = 1
  after = 0
  for i in D:
    if i == num:
      after += 1
    elif i == num+1:
      ans *= before**after
      num += 1
      before = after
      after = 1
    else:
      ans = 0
  ans *= before**after
print(ans%998244353)
# Judge status: Accepted
from fractions import gcd
from functools import reduce
n=int(input())
t=[int(input()) for i in range(n)]
def lcm(x,y):
  return x*y//gcd(x,y)
ans=reduce(lcm,t)
print(ans)
# Judge status: Accepted
s=input()
state=0
mai=0
for i in range(len(s)):
  k=int(s[len(s)-1-i])
  if state==1:
    k=k+1
    if k<0:
      k=10+k
  elif state==2:
    if k>=5:
      k=k+1
      if k<0:
        k=10+k
  if k>5:
    mai+=10-k
    state=1
  elif k<5:
    mai+=k
    state=0
  elif k==5:
    state=2
    mai+=k
if k>=6:
  mai+=1
print(mai)
# Judge status: Wrong Answer
n=int(input())
a=list(map(str,input().split()))
b,c=[],[]
for i in range(n):
    if i%2==0:
        b.append(a[i])
    else:
        c.append(a[i])
c.reverse()
print(" ".join(c+b))
# Judge status: Wrong Answer
N,M = list(map(int,input().split()))
a = list(map(int,input().split()))

import math
import sys

tmp = 1
for i in range(N):
    lcm = tmp*(a[i]//2)//math.gcd(tmp,(a[i]//2))
    tmp = lcm
    
for i in a:
    if tmp // i % 2 == 0:
        print(0)
        sys.exit()
print(ceil((M // tmp) / 2))
# Judge status: Accepted
N = int(input())
i = 1
while True:
  if i*(i+1)/2 >= N:
    print(i)
    break
  i += 1
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))

OKs = 0
import itertools
for c in itertools.combinations(L, 3):
  if len(set(c))==3:
    c = sorted(list(c))
    c1, c2 = c[2], c[:2]
    if sum(c2) > c1:
      OKs += 1

print(OKs)
# Judge status: Accepted
n = input()
if n[-1] in ['2', '4', '5', '7', '9']:
    print('hon')
elif n[-1] in ['0', '1', '6', '8']:
    print('pon')
else:
    print('bon')
# Judge status: Wrong Answer
a,b = map(int,input().split())
s = max(2*a,2*b,a+b)
if s == 2 *a or 2*b:
    print(s-1)
else:
    print(s)
# Judge status: Wrong Answer
n, w = map(int,input().split())
maxi = 0
possibilities = []
for i in range(n):
    wi, vi = map(int, input().split())
    to_add =[[wi, vi]]
    for wp, vp in possibilities:
        wa = wp + wi
        if wa < w:
            va = vp + vi
            maxi = max(maxi,va)
            to_add.append([wp+wi, va])
        elif wa == w:
            va = vp + vi
            maxi = max(maxi, va)
    possibilities += to_add
print(maxi)
# Judge status: Wrong Answer
K,X=map(int,input().split())

for i in range(X-K+1,X+K-1):
  print(i,end=" ")