peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
x = int(input())
if x in [3,5,7]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
# coding: utf-8
import sys
from collections import deque

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = deque(sr())
Q = ir()
rev = 0
for _ in range(Q):
    q = sr().split()
    if q[0] == '1':
        rev ^= 1
    else:
        _, f, c = q
        if (int(f)^rev)&1:
            S.appendleft(c)
        else:
            S.append(c)

if rev&1:
    S.reverse()

print(''.join(S))
# 06
# Judge status: Accepted
a = int(input())
w_list = list(map(int,input().split()))
ans = abs(w_list[0] - sum(w_list[1:]))
for i in range(a):
    list_1 = w_list[:i+1]
    list_2 = w_list[i+1:]
    if abs(sum(list_2) - sum(list_1)) < ans:
        ans = abs(sum(list_2) - sum(list_1))
print(ans)
# Judge status: Wrong Answer
n,k = map(int, input().split())
X = list(map(int, input().split()))
ans = 10**8


for i in range(n-k+1):
  l = X[i]
  r = X[i+k-1]
  
  ans = min(ans, (r-l+min(abs(l), abs(r))))
  
print(ans)
# Judge status: Accepted
from itertools import combinations

n, x, y = map(int, input().split())

cnt = [0] * n
for i, j in combinations(range(1, n + 1), 2):
    dist = min(abs(j - i), abs(i - x) + abs(j - y) + 1,
               abs(i - y) + abs(j - x) + 1)
    cnt[dist] += 1

for i in range(1, n):
    print(cnt[i])
# Judge status: Accepted
S = input().rstrip()

if 'AB' in S or 'BA' in S:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, x = map(int, input().split())
l = list(map(int, input().split()))
ans = 1
p = 0
for i in range(n):
    p += l[i]
    if p <= x:
        ans += 1
    
print(ans)
# Judge status: Wrong Answer
N, Q=map(int, input().split())
S=list(input())
L=[0]*(N)
s=[0]*(N+1)
for i in range(1,N):
  if S[i-1]=="A" and S[i]=="C":
    L[i]=1
    
for i in range(N):
  s[i+1]=s[i]+L[i]
for i in range(Q):
  l,r=map(int, input().split())
  print(s[l]-s[r-1])
# Judge status: Accepted
a, b = map(int, input().split())

if ((a + b) / 2 - (a + b) // 2 >= 0.5):
	print((a + b) // 2 + 1)
else:
	print((a + b) // 2)
# Judge status: Accepted

def main():
    K = int(input())
    cnt = 1
    a = 7%K
    s = {a}
    for i in range(K):
        if a%K == 0:
            print(cnt)
            return
        a = a*10 + 7
        a = a % K
        if a in s:
            print(-1)
            return
        s.add(a)
        cnt += 1

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n=int(input())
s = input()
l = 0
r = 0
ans = 0
f = 1
for i in range(n):
    if i != 0 and s[i - 1] == "." and s[i] == "#":
        ans += min(l,r)
    if s[i] == "#":
        l += 1
        r = 0
    else:
        r += 1
    if i == n - 1 and s[i] == ".":
        ans += min(l, r)
print(ans)
# Judge status: Accepted
n = int(input())
aList = list(map(int, input().split()))
aList.sort(reverse=True)
sums = 0
for i in range(n):
    if i % 2 == 0:
        sums += aList[i]
    else:
        sums -= aList[i]
print(sums)
# Judge status: Accepted
# solution
import io

n=[input() for i in range(int(input()))]
m=[input() for i in range(int(input()))]
array=list(set(n))
print(max(0,max(n.count(array[i])-m.count(array[i]) for i in range(len(array)))))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
    if i == 0:
        ans = 0
    else:
        if A[i] > A[i-1]:
            ans = ans + A[i] - A[i-1]
print(ans)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
f = 0
ans = 0
while f == 0:
    for i in range(n):
        if not A[i]%2 == 0:
            f = 1
    if f == 0:
        ans += 1
        for j in range(n):
            A[j] /= 2
print(ans)
# Judge status: Accepted
N = int(input())
a, b = 2, 1

for i in range(N - 1):
    a, b = b, (a + b)
print(b)
# Judge status: Wrong Answer
# ume 20/01/03
# abc149-dが解けないのでやった
def chmin(a, b):
  if a > b:
    return b
  else:
    return a

def main():
  dp = [1e4+10]*100010
  hs = [0]*100010
  N = int(input())
  hs[:N] = map(int, input().split())
  
  dp[0] = 0
  for i in range(N):
    dp[i+1] = chmin(dp[i+1], dp[i]+abs(hs[i+1]-hs[i]))
    dp[i+2] = chmin(dp[i+2], dp[i]+abs(hs[i+2]-hs[i]))
  print(dp[N-1])

if __name__ == '__main__':
  main()
# Judge status: Accepted
N = int(input())
S = input().rstrip()
res = 0
for i in range(N):
    res = max(len(set(S[i:]) & set(S[:i])), res)
print(res)
# Judge status: Wrong Answer
x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())))[a-x::]
q=sorted(list(map(int,input().split())))[b-y::]
r=sorted(list(map(int,input().split())))[::-1]
p+=[0]*y
q+=[0]*x
if c<x+y:
  r+=[0]*(x+y-c)
i=0
j=0
ans=0
for k in range(x+y):
  if r[k]>p[i] and i<x:
    ans+=r[k]
    i+=1
  elif r[k]>q[i] and j<y:
    ans+=r[k]
    j+=1
  else:
    break
print(ans+sum(p[i:])+sum(q[j:]))
# Judge status: Accepted
N = int(input())
for j in range(1,10):
  for k in range(1,10):
    if j * k == N:
      print('Yes')
      exit()
print('No')
# Judge status: Accepted
import heapq
import math
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = list(map(lambda x: x*(-1), a)) 
heapq.heapify(a)
for i in range(m):
    tmp = math.ceil(heapq.heappop(a)/2)
    heapq.heappush(a, tmp)
a = list(map(lambda x: x*(-1), a)) 
print(sum(a))
# Judge status: Accepted
n,m=list(map(int,input().split()))
mod=10**9+7

if abs(n-m)>1:
    print(0)
    exit(0)

if abs(n-m)==1:
    ans=1
else:
    ans=2

while n>0:
    ans*=n
    ans%=mod
    n-=1

while m>0:
    ans*=m
    ans%=mod
    m-=1

print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
if n==m:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n,k=map(int,input().split())
s=0
l=list(map(int,input().split()))
c=0
i=0
while(s<=k and i<n):
    s+=l[i]
    i+=1
    c+=1
print(c)
# Judge status: Accepted
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys
import itertools

# import math

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


A, B = map(int, readline().split())
print(A*B//gcd(A,B))
# Judge status: Wrong Answer
n = int(input())

ans = 0

for i in range(n):
    if i == 0:
        ans = 1
    else:
        ans *= 2
# Judge status: Accepted
n=input()
c=[int(i) for i in n]
print("Yes" if sum(c)%9==0 else "No")
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
if a>=k:
    a1=a-k
else:
    a1=0
if b>=k-a:
    b1=b-(k-a)
else:
    b1=0
print(a1,b1)
# Judge status: Accepted
N=int(input())
task=[list(map(int,input().split())) for _ in range(N)]
time=0
flag=1
task.sort(key=lambda x:x[1])
#print(task)
for i in range(N):
    time=time+task[i][0]
    if not(time<=task[i][1]):
        flag=0
        break
if flag==1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
L = int(input())
 
print((L/3)**3)
# Judge status: Accepted
a=list(map(int,input().split()))
a.sort()
count=0
while a[1]!=a[2]:
    a[1]+=1
    a[0]+=1
    count+=1

if (a[1]-a[0])%2==0:
    count+=(a[1]-a[0])//2
else:
    count+=(a[1]-a[0])//2+2

print(count)
# Judge status: Accepted
N, M = list(map(int, input().split()))
if 2 * N <= M:
    print(N + (M - 2 * N) // 4)
else:
    print(M // 2)
# Judge status: Accepted
import sys


numbers = sys.stdin.readline().split(' ')

a = int(numbers[0])
b = int(numbers[1])
c = int(numbers[2])


if a > 0:
    print(b//c - (a-1)//c)
else:
    print(b//c+1)
# Judge status: Wrong Answer
H, N = map(int, input().split())
da, cost = [0] * N, [0] * N
for i in range(N):
    da[i],cost[i]=map(int, input().split())

max_da=max(da)*2  
dp = [float("inf") for i in range(H+max_da)]
dp[0]=0

for j in range(N):
    for i in range(H+max_da):
        #if i-da[j]>=0:
            dp[i]=min(dp[i],dp[i]+cost[j])

ans=0
for i in range(H,H+max_da):
    if type(dp[i])==int:
        ans=dp[i]
        break
print(ans)
# Judge status: Accepted
n,a,b=map(int,input().split())
s=input()

cnta=0
cntb=0

for i in range(n):
    if s[i]=="a":
        if cnta+cntb<a+b:
            print("Yes")
            cnta+=1
        else:
            print("No")
    elif s[i]=="b":
        if cntb<b and cnta+cntb<a+b:
            print("Yes")
            cntb+=1
        else:
            print("No")
    else:
        print("No")
# Judge status: Accepted
from collections import Counter
n, m = map(int, input().split())
l = []
a0 = 0
for i in range(m):
    a = int(input())
    if a - a0 == 0:
        print(0)
        exit()
    l.append(a - a0 - 1)
    a0 = a + 1
l.append(n - a0)
d = Counter(l)
key = list(d.keys())

ma = max(key)
fib = [1]*(ma + 1)
for i in range(2, ma + 1):
    fib[i] = fib[i - 2] + fib[i - 1]

ans = 1
for k in key:
    ans *= fib[k]**d[k]
    ans %= 10**9 + 7

print(ans)
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
print((B+C)-A)
# Judge status: Accepted
s= int(input())
print("YES" if s == 3 or s == 5 or s == 7 else "NO")
# Judge status: Accepted
h, n = map(int, input().split())
data = list(map(int, input().split()))

sum = sum(data)

if h > sum:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
N=list(input())
s=set(N)
ans=''.join(sorted(s))
all=[chr(i) for i in range(97,97+26)]
if ans=='abcdefghijklmnopqrstuvwxyz':
  print('None')
  exit()
for i in range(len(ans)):
  if ans[i]!=all[i]:
    print(all[i])
    exit()
  elif i==len(ans)-1 :
    print(all[len(ans)])
    exit()
# Judge status: Wrong Answer
A = list(map(int,input().split()))
if sum(A) <= 22:
    print("bust")
else:
    print("win")
# Judge status: Wrong Answer
A,B,C,D = map(int,input().split(' '))
if B < C:
  print(0)
else:
  print(min(B-A,min(D-C,C-B)))
# Judge status: Accepted
N, M = map(int, input().split())
L = 1
R = N
for i in range(M):
  l, r = map(int, input().split())
  if L < l:
    L = l
  if R > r:
    R = r
print(max(1+R-L, 0))
# Judge status: Accepted
N, K = map(int, input().split())
S = input()

def calc_happiness(S):
    cnt = 0
    for i in range(1, len(S)):
        if S[i-1] == S[i]:
            cnt += 1
    return cnt

print(min(N-1, calc_happiness(S)+ K*2))
# Judge status: Accepted
from sys import stdin
def S(): return stdin.readline().rstrip()
    
s = list(S())

print(s.count('1'))
# Judge status: Accepted
import fractions

N,M = map(int, input().split())
l_a = list(map(int, input().split()))
l_num = []
lcm = 1

flg = True
for a in l_a:
  a //= 2
  if not a in l_num:
    l_num.append(a)
  lcm = lcm * a // fractions.gcd(lcm, a)
  if lcm > M:
    flg = False
    break
if flg:
  for num in l_num:
    if lcm > num and lcm // num % 2 == 0:
      flg = False
if flg:
  print((M // lcm + 1) //2)
else:
  print(0)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)
# Judge status: Accepted
def main():
    S = input()
    length = len(S)
    loop_count = length // 2
    count = 0

    for i in range(loop_count):
        if(S[i] != S[length - i -1]):
            #print(S[i],"==",S[loop_count - i -1])
            count += 1

    print(count)


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

output = ''

if len(S) >= K:
    for l in S:
        if l != '1':
            output = l
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break
    
if output:
    print(output)
else :
    print('1')
# Judge status: Wrong Answer
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v*t + a >= w*t + b and a < b:
    print("YES")
elif v*t + a <= w*t + b and a > b:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
N=int(input())
pre=int(input())
ans=pre//2
pre=pre&1
for i in range(2,N+1):
    Ai=int(input())
    ans+=Ai//2
    if pre and Ai&1:
        ans+=1
        pre=0
    else:
        pre=Ai&1
print(ans)
# Judge status: Accepted
s = list(map(str, input().rstrip()))
k = int(input())

ans = 1
for x in s[:k]:
    if int(x) != 1:
        ans = int(x)
        break
print(ans)
# Judge status: Accepted
w = input()
w_dict = {}
for char in w:
    if char in w_dict:
        w_dict[char] += 1
    else:
        w_dict[char] = 1

if all(elem%2 == 0 for elem in w_dict.values()):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N,M=map(int,input().split())
a=list(map(int,input().split()))


import fractions
a[0]=a[0]//2
k=a[0]
for j in range(N-1):
  i=j+1
  a[i]=a[i]//2
  k=a[i]*k//fractions.gcd(k,a[i])

l=M//k
if l%2==0:
  print(l//2)
else:
  print(l//2+1)
# Judge status: Accepted
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())

if max(a,b,c) == a:
    ans = b + c + a*(2**k)
elif max(a,b,c) == b:
    ans = a + c + b*(2**k)
elif max(a,b,c) == c:
    ans = a + b + c*(2**k)

print(ans)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N, M = map(int, input().split())
    AB = [tuple(map(int, input().split())) for _ in range(N)]
    AB = sorted(AB, key=lambda x: x[0])

    ans = 0
    for a, b in AB:
        if M > b:
            M -= b
            ans += a * b
        else:
            ans += a * M
            print(ans)
            exit()

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
list = list(map(int,input().split()))
if list[0] % list[1] == 0:
  time = list[2]*list[0]/list[1]
else :
  time = list[2]*(list[0]/list[1]+1)
print (time)
# Judge status: Wrong Answer
N = int(input())
S = input()
L = []
x = 0
for c in S:
  if c == 'I':
    x += 1
    L.append(x)
  elif c == 'D':
    x -= 1
    L.append(x)
print(max(L))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
d = {}
ans = 0

for i in range(n):
    l = i + a[i]
    r = i - a[i]
    if l not in d:
        d[l] = 1
    else:
        d[l] += 1
    if r in d:
        ans += d[r]

print(ans)
# Judge status: Accepted
r=int(input())





print(2*r*3.14159265)
# Judge status: Accepted
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

max_x = max(max(x), X)
min_y = min(min(y), Y)

if max_x < min_y:
    print('No War')
else:
    print('War')
# Judge status: Accepted
n = int(input())
cnt = 0
for i in range(1, n+1):
    if i * (1+i) // 2 >= n:
        cnt = i
        break
for i in range(cnt, 0, -1):
    if i <= n:
        print(i)
        n -= i
# Judge status: Wrong Answer
s=sorted(set(input()))
ro='abcdefghijklmnopqrstuvwxyz'
if len(s)==len(ro):
    print('None')
else:
    for i in range(len(s)):
        if s[i]!=ro[i]:
            print(ro[i])
            break
        if s[-1]!=ro[len(ro)-1]:
            print(s[-1])
            break
# Judge status: Accepted
n = int(input())
s = input()

c = 0
ans = 0
for i in list(s):
    if i == 'I':
        c+=1
    else:
        c-=1
    ans = max(ans, c)
print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
dct = {}
exist = True
for _ in range(m):
    s, c = map(int, input().split())
    if n != 1 and s == 1 and c == 0:
        exist = False

    if s in dct.keys():
        if dct[s] != c:
            exist = False
    else:
        dct[s] = c

if not (1 in dct.keys()):
    dct[1] = 1

if exist:
    ans = 0
    for s, c in dct.items():
        ans += c*10**(n-s)
    print(ans)
else:
    print(-1)
# Judge status: Wrong Answer
import sys

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


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

    cnt = sum(b) - sum(a)
    c = [x - y for x, y in zip(a, b)]
    neg = - sum(x for x in c if x < 0)
    pos = sum(x for x in c if x > 0)

    if neg > cnt * 2 or pos > cnt:
        print("No")
    else:
        print("Yes")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
H = int(input())
W = int(input())
N = int(input())

upper = H if H >= W else W

print((upper // N) + 1)
# Judge status: Accepted
a, b = map(int, input().split())
ans = 0
for _ in range(2):
    if a >= b:
        ans += a
        a -= 1
    else:
        ans += b
        b -= 1

print(ans)
# Judge status: Accepted
from sys import stdin,stdout
n,k=map(int,stdin.readline().split())
a=list(map(int,stdin.readline().split()))
for i in range(k,n):
    print('Yes' if a[i]>a[i-k] else 'No')
# Judge status: Accepted
import math
n = int(input())
l = ["".join(sorted(input())) for i in range(n)]
l.sort()
c = 0
b = l[0]
ans = 0
for s in l[1:]:
    if s == b:
        c += 1
    else:
        ans += c * (c + 1) * 0.5
        c = 0
    b = s
ans += c * (c + 1) * 0.5
print(int(ans))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
for i in range(N):
    b = B[i]
    if B[i] <= A[i]:
        cnt += B[i]
    elif B[i] <= A[i] + A[i + 1]:
        cnt += B[i]
        A[i + 1] -= B[i] - A[i]
    else:
        cnt += A[i] + A[i + 1]
        A[i+1] = 0
print(cnt)
# Judge status: Accepted
def dfs(i, f, sum):
  if i == 3:
    if sum == 7:
      print(f + '=7')
      exit()
      
  else:
    dfs(i+1, f + '-' + n[i+1], sum-int(n[i+1]))
    dfs(i+1, f + '+' + n[i+1], sum+int(n[i+1]))
    
n = input()
dfs(0, n[0], int(n[0]))
# Judge status: Accepted
N = int(input())
g = [0] * (N+1)
for i in range(N):
    g[i+1] = int(input())

s = 1
cnt = 0
arrive = [0] * (N+1)
while s != 2:
    if arrive[s] == 1:
        print(-1)
        exit()
    arrive[s] = 1
    s = g[s]
    cnt += 1

print(cnt)
# Judge status: Wrong Answer
x = int(input())
if (x >= 100) & (((x - (x // 100) * 100) // 5) <= x // 100):
    print(1)
else:
    print(0)
# Judge status: Accepted
N=int(input())
plist=list(map(int,input().split()))

pmin=10**9
answer=0
for p in plist:
  if p<pmin:
    answer+=1
    pmin=p

print(answer)
# Judge status: Accepted
#abc079 c
s=input()


def dfs(i,num,ans):
    #print(i,num,ans)
    if i==3:
        if num==7:
            global memo
            memo=ans
        return 0
    dfs(i+1,num+int(s[i+1]),ans+"+"+str(s[i+1]))
    dfs(i+1,num-int(s[i+1]),ans+"-"+str(s[i+1]))
    return 0

memo=""
dfs(0,int(s[0]),s[0])
memo+="=7"
print(memo)
# Judge status: Wrong Answer
import numpy as np
tmp=[int(i) for i in input().split(' ')]
tmp_s=np.array([int(i) for i in input().split(' ')])
score=[]
leng=tmp[0]-tmp[1]+1
for i in range(leng):
  t=np.prod(tmp_s[i:i+tmp[1]])
  score.append(t)
  if i>0:
    if score[i-1]<score[i]:
      print('Yes')
    else:
      print('No')
0
# Judge status: Wrong Answer
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

H.sort()

ans = H[2] - H[0]

for i in range(N - K + 1):
    tmp = H[i + K - 1] - H[i]
    if tmp < ans:
        ans = tmp

print(ans)
# Judge status: Wrong Answer
# 126 B

s = input()

fir = int(s[:2])
sec = int(s[2:])

if fir > 0 and sec > 0:
    if 1 <= fir <= 12 and 1 <= sec <= 12 :
        print("AMBIGUOUS")
    elif 1 <= fir <= 12: 
        print("MMYY")
    elif 1 <= sec <= 12:
        print("YYMM") 
    else:
        print("NA")
else:
    print("NA")
# Judge status: Accepted
# 初期入力
import sys
input = sys.stdin.readline

#
N = int(input())
S = [input().strip() for i in range(N)]

from collections import Counter
c = Counter(S)
print(len(c))
# Judge status: Wrong Answer
a,b = map(int,input().split())

num = 1
while True:
  if a * num - (num-1) >= b:
    break
    
  num += 1
  
print(num)
# Judge status: Wrong Answer
S=input()
N=len(S)
L,R=[0],[0]
for s in S:
    if s == '<': L.append(L[-1]+1)
    else: L.append(0)
for s in S[::-1]:
    if s == '>': R.append(R[-1]+1)
    else: R.append(0)
ans = 0
for i in range(N):
    ans += max(L[i+1], R[-2-i])
print(ans)
# Judge status: Accepted
from heapq import heappush, heappop
import math
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
A =list(map(int, input().split()))
Hq = []
for a in A:
  heappush(Hq, -a)
 
for _ in range(m):
  max = -heappop(Hq)
  heappush(Hq, -math.floor(max/2))
print(-sum(Hq))
# Judge status: Accepted
import math

a,b,h,m = map(int,input().split())
d = abs(30*h+0.5*m-6*m)
c = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(d)))
print(c)
# Judge status: Accepted
N = int(input())
minimum = 100 
total = 0
for i in range(N):
    s = int(input())
    total += s 
    if s % 10 != 0:
        minimum = min(minimum,s)
if total % 10 != 0:
    print(total)
elif minimum == 100:
    print(0)
else:
    print(total - minimum)
# Judge status: Accepted
A, B = [int(_) for _ in input().split()]
print((A + B)%24)
# Judge status: Accepted
h1, m1, h2, m2, k = map(int, input().split())
print(max((h2-h1)*60+m2-m1-k, 0))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
MAX = max(a)
ans = 0
maxflg = False
minflg = False
for i in range(n):
    if a[i] == MAX:
        maxflg = True
        if i == 0:
            index = i + 1
        else:
            index = i
        leftMAX = max(a[:index])
    if maxflg:
        ans += MAX - a[i]

for i in range(n):
    if a[i] == MAX:
        break
    else:
        ans += leftMAX - a[i] 
print(ans)
# Judge status: Accepted
# coding: utf-8
n = int(input())
dp1 = [0] * n
dp2 = [0] * n
dp3 = [0] * n
#print(dp1)
a, b, c = map(int,input().split())
dp1[0] = a
dp2[0] = b
dp3[0] = c
for i in range(1,n):
    a, b, c = map(int,input().split())
    dp1[i] = max(dp2[i-1]+a, dp3[i-1]+a)
    dp2[i] = max(dp1[i-1]+b, dp3[i-1]+b)
    dp3[i] = max(dp2[i-1]+c, dp1[i-1]+c)
print(max(dp1[n-1], dp2[n-1], dp3[n-1]))
# Judge status: Accepted
s = input()
t = input()

s_asc = ''.join(sorted(s))
t_desc = ''.join(sorted(t, reverse=True))
print('Yes' if s_asc < t_desc else 'No')
# Judge status: Accepted
a,b,c = [int(i) for i in input().split()]
if (a*b*c)%2==0:
    print(0)
else:
    ans = a*b
    ans = min(ans, b*c)
    ans = min(ans, c*a)
    print(ans)
# Judge status: Accepted
S = input().replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
if S == '':
    print('YES')
else:
    print('NO')
# Judge status: Accepted
sets = sorted(list(map(int, input().split())))
print('YES' if sets == [5, 5, 7] else 'NO')
# Judge status: Wrong Answer
n = int(input())

res = 1

for i in range(1, n):
  res = res*i%(10**9+7)

print(res)
# Judge status: Wrong Answer
from math import ceil
 
n, k = map(int, input().split())
a = list(map(int, input().split()))
idx = a.index(1)
if idx == 0:
    print(ceil(len(a[(idx + 1):]) / (k - 1)))
elif idx == (n - 1):
    print(ceil(len(a[:idx]) / (k - 1)))
else:
    ans = (ceil(len(a[:idx]) / (k - 1))) + (ceil(len(a[(idx + 1):]) / (k - 1)))
    if (k - 1) < len(a[:idx]) % (k - 1) + len(a[(idx + 1):]) % (k - 1):
        ans -= 1
    print(ans)
# Judge status: Accepted
N = int(input())
S = str(input())

if N % 2 != 0:
    print("No")
else:
    if S[:int(N/2)] == S[int(N/2):N]:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
N=int(input())
S=str(input())
x,ans=0,0
for i in range(N):
    if S[i]=="I":
        x+=1
        if ans<x:
            ans=x
    elif S[i]=="D":
        x-=1

print(ans)
# Judge status: Wrong Answer
def main():
  S=input()
  nums = len(S)
  print(type(nums))
  xs = ''
  for num in range(nums):
    xs += "x"
  print(xs)
main()
# Judge status: Wrong Answer
n=int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
    x=input()
    if (x=="RE"):
        re+=1
    if (x=="WA"):
        wa+=1
    if (x=="TLE"):
        tle+=1
    if (x=="AC"):
        ac+=1
print("AC *",ac)
print("WA *",wa)
print("TLE *",tle)
print("RE *",re)
# Judge status: Wrong Answer
n = int(input())
if n % 2 == 0:
    print(n/2)
else:
    print(n//2 +1)
# Judge status: Wrong Answer

node_num, l_connected_node, g_connected_node = [int(n) for n in input().rstrip().split()]

l_connected_node-=1
g_connected_node-=1

count=[0]*node_num

for i in range(node_num-1):
    for j in range(i+1, node_num):
        count[min(j-i, abs(i-l_connected_node)+abs(j-g_connected_node)+1)]+=1

for x in range(1, node_num):
    print(x,'jump :',count[x])