peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
def sumNum(num, sums):
    if num == 0:
        return sums
    sums += num % 10
    num = num // 10
    return sumNum(num, sums)

N = int(input())
keta = 100001

for A in range(2, N):
    B = N - A
    _A = sumNum(A, 0)
    _B = sumNum(B, 0)
    ret = _A + _B

    if keta <= ret:
        continue
    keta = ret

print(keta)
# Judge status: Accepted
n, k = map(int, input().split())
data = list(map(int, input().split()))
ng = set(data)
for i in range(n, 10*n+1):
    if all(int(c) not in ng for c in str(i)):
        print(i)
        break
# Judge status: Wrong Answer
s = input()
if int(s[5:6]) <=4:
  print('Heisei')
else:
  print('TBD')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
money = 1000
cnt = 0
if A[0] < A[1]:
    cnt += 1000 // A[0]
    money -= cnt * A[0]
for i in range(1, N-1):
    if A[i] <= A[i - 1] and A[i] < A[i + 1]:
        cnt += money // A[i]
        money -= cnt * A[i]
    elif A[i] >= A[i-1] and A[i] > A[i + 1]:
        money += cnt * A[i]
        cnt = 0
if cnt != 0:
    money += cnt * A[N - 1]
    cnt = 0
print(money)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ans = 1000
for i in range(n - 1):
    if a[i] < a[i + 1]:
        ans = ans % a[i] + (ans // a[i]) * a[i + 1]

print(ans)
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()

char = set()
for i in range(n):
    char.add(s[i])
    char.add(t[i])

print(len(char))
# Judge status: Wrong Answer
def main():
    import math
    H = int(input())
    if H == 1:
        print(1)
    else:
        if H%2 != 0:
            H += 1
        count = int(math.log(H,2))
        ans = 0
        for i in range(count):
            ans += 2**(i)
            if i == count-1:
                ans += 2**(i+1)
        print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=int(input())
rec=[]
for i in range(n):
    a,b=input().split()
    rec.append([a,int(b),i+1])
rec.sort()
for i in rec:
    print(i[2])
# Judge status: Accepted
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
m = abs(a-b)
if a>b:
  if (v-w)*t>=m:
    print("YES")
  else:
    print("NO")
else:
  if (v-w)*t>=m:
    print("YES")
  else:
    print("NO")
# Judge status: Accepted
N, M = map(int, input().split())
m = min(N, M//2)
N = N-m
M = M - m * 2
if N == 0:
    print(m + M//4)
else:
    print(m)
# Judge status: Accepted
S=input()
ans=cur=0
for c in S:
    if c in 'ACGT':
        cur+=1
        ans=max(ans,cur)
    else:
        cur=0
print(ans)
# Judge status: Accepted
# (0,0),(a,b),(c,d)
# (10**9, 1)(x,y)
# 10**9 * y - x == S
# S = 10**9 * a + bとおくと
# y = a + 1
# x = 10**9- b

S=int(input())
if S==10**18:
  print(0,0,10**9,0,0,10**9)
  exit(0)
DIV=10**9
a = S//DIV
b = S%DIV
x = 10**9-b
y = a + 1
if x>10**9:
  print(x)
if y>10**9:
  print(y)
print(0,0,10**9,1,x,y)
# Judge status: Wrong Answer
def f(x):
    return x%10+f(x//10) if x else 0
n = int(input())
print(min([f(i)+f(n-i) for i in range(0,n+1)]))
# Judge status: Accepted
N, M = map(int, input().split())

#四つ角：4回
#辺上：6回
#内側：9回
if N==1 and M==1:
    print(1)
elif N == 1 or M ==1:
    #端：2回
    #その他：3回
    print(max(N-2,M-2))
else:
    print((N-2)*(M-2))
# Judge status: Accepted
print("YES" if input() in ["3","5","7"] else "NO")
# Judge status: Accepted
from collections import Counter
input();a=Counter(map(int,input().split()))
print(sum(j if i>j else j-i for i,j in a.items()))
# Judge status: Accepted
X, K, D = list(map(int, input().split()))
X = abs(X)

zan = X%D


K2 = K-X//D
if K2 < 0:
  print(X-D*K)
else:
  if K2%2 == 0:
  	print(zan)
  else:
  	print(D-zan)
# Judge status: Accepted
H, N = map(int, input().split())
A = map(int, input().split())
a_sum = sum(A)

if H - a_sum <= 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
 
ans = ''
while n != 0:
  if n%2 != 0:
    n -= 1
    ans = '1' + ans
  else:
    ans = '0' + ans
  n = n//(-2)
  
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
l = [0]*(10**5+3)
for i in range(n):
  l[a[i]] += 1
  l[a[i]+1] += 1
  l[a[i]+2] += 1
max_ = 0
for e in l:
  max_ = max(max_, e)
print(max_)
# Judge status: Accepted
D, T, S = map(int, input().split())
if D <= T * S:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
#a>=3200　のとき　出力s
#a<3200　のとき　出力’red'
#標準入力

#aは数字でユーザーが入力する
a = int (input())
if a >= 3200:
    print('s')
else:
    print('red')
# Judge status: Wrong Answer
x,y,z=map(int,input().split())
if x%(y+z)<=z:
  print(x//(y+z))
else:
  print(x//(y+z)-1)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
alice = 0
bob = 0
sorted_a = sorted(a)

for i in sorted_a:
    alice += sorted_a.pop()
    bob += sorted_a.pop()

print(alice - bob)
# Judge status: Accepted
n, m = map(int, input().split())

print(m // 2 if m <= 2 * n else n + (m - 2 * n) // 4)
# Judge status: Accepted
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
pairs = list(tuple(map(int, input().split())) for _ in range(Q))

init_sum = sum(A)
counter = Counter(A)
total = init_sum

for b, c in pairs:
    total -= counter[b] * b
    total += counter[b] * c
    counter[c] += counter[b]
    del counter[b]
    print(total)
# Judge status: Wrong Answer
n , m, p = map(int, input().split())
#lst = list(map(int, input().split()))
if int(n/p) <= m:
    print("Yes")
else:
    print('No')
# Judge status: Accepted
N = int(input())
count_AC = 0
count_WA = 0
count_TLE = 0
count_RE = 0 


for i in range(N):
    tmp = str(input())
    if tmp == "AC":
        count_AC += 1
    elif tmp == "WA":
        count_WA += 1
    elif tmp == "TLE":
        count_TLE += 1
    else:
        count_RE += 1

print("AC x " + str(count_AC))
print("WA x " + str(count_WA))
print("TLE x " + str(count_TLE))
print("RE x " + str(count_RE))
# Judge status: Accepted
N, K = map(int, input().rstrip().split(' '))
frog_lst = list(map(int, input().rstrip().split(' ')))
frog_jump_lst = []

def frog_jump(frog_jump_lst=[], index=0):
  if not frog_jump_lst:
    frog_jump_lst.append(0)
  else:
    now_pos = frog_lst[index]
    k = min(K, len(frog_jump_lst))
    pattern = [abs(now_pos - frog_lst[index-i]) + frog_jump_lst[-i] for i in range(1,k+1)]
    frog_jump_lst.append(min(pattern))

for j in range(N):
  frog_jump(frog_jump_lst, j)
print(frog_jump_lst[-1])
# Judge status: Accepted
import numpy as np

n,m,x=map(int,input().split())
ca=[]
for _ in range(n):
  ca.append(list(map(int,input().split())))
# print(ca)
minimum=10**7

for i in range(2**n):
#  print(i)
  tmp=[]
  tmp2=[0]*(m+1)
  cnt=0
  for j in range(n):
    if ((i >> j) & 1):
      tmp.append(ca[j])
      cnt+=1
#  print(tmp)
  for k in range(cnt):
    for l in range(m+1):
      tmp2[l]+=tmp[k][l]
# print(tmp2)
  if min(tmp2[1:])>=x:
    minimum=min(minimum,tmp2[0])
print(minimum if minimum < 10**7 else '-1')
# Judge status: Accepted
S = input()
count0 = 0
count1 = 0
for i in range(len(S)):
    if S[i] == '0':
        count0 += 1
    else:
        count1 += 1
print(min(count0,count1)*2)
# Judge status: Accepted
import numpy as np


def main():
    n = int(input())
    As = [list(map(int, input().split())) for _ in range(2)]
    cumsum0 = np.cumsum(As[0])
    cumsum1 = np.cumsum(As[1])

    ans = -float('inf')
    for i in range(n):
        ans_temp = cumsum0[i] + (cumsum1[n-1] - cumsum1[i]) + As[1][i]
        ans = max(ans, ans_temp)
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
def prime_factor(n):
  ass=[]
  for i in range(2,int(n**0.5)+1):
    while n%i==0:ass.append(i);n//=i
  if n!=1:ass.append(n)
  return ass

n = int(input())
ans = 0
pf = prime_factor(n)

from collections import Counter
c = Counter(pf)
for i in c.keys():
    v = c[i]
    for j in range(1, 10**20):
        if j>v:
            break
        ans += 1
        v -= j
print(ans)
# Judge status: Accepted
a = input()
if a.upper() == a:
	print('A')
else:
	print('a')
# Judge status: Accepted
P,Q,R=map(int,input().split())
L=sorted([P,Q,R])
print(L[0]+L[1])
# Judge status: Accepted
a = input()
b = a[: 4] + a[5 : 7] + a[8 :]
c = int(b)
if c <= 20190430:
    print('Heisei')
else:
    print('TBD')
# Judge status: Accepted
A = int(input())

a = 10**9 - A % (10**9)
b = A // (10**9) + 1


if b > 10**9:
    print(0, 0, 10**9, 0, 0, 10**9)
else:
    print(0, 0, 10**9, 1, a, b)
# Judge status: Wrong Answer
import math
n = int(input())
m = math.sqrt(n)
print(math.floor(m))
# Judge status: Accepted
n=int(input())
a=[int(x) for x in input().rstrip().split()]

now=1
mod=10**9+7
def lcm(a,b):#最小公倍数
    ori_a=a
    ori_b=b
    while b!=0:
        a,b=b,a%b
    return (ori_a*ori_b)//a
  
for i in a:
  now=lcm(i,now)
# print(now)
print(sum([now//i for i in a])%mod)
# Judge status: Accepted
a,b,c = map(int, input().split())

if a+b==c or b+c==a or a+c==b:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            count += 1
        else:
            count -=200
print("APPROVED" if count >=1  else "DENIED")
# Judge status: Accepted
n, l = map(int, input().split())
s = [input() for i in range(n)]

s_s = sorted(s)

print("".join(s_s))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
k = 0
ans = 0
for i in range(len(A)):
  if i == 0:
    ans += B[A[i]-1]
    k = A[i]
  else:
    if A[i]-k == 1:
      ans += B[A[i]-1]
      ans += C[A[i]-2]
      k = A[i]
    else:
      ans += B[A[i]-1]
      k = A[i]
print(ans)
# Judge status: Accepted
n = int(input())
list = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    if i%2==0 and list[i]%2==1:
        ans += 1
print(ans)
# Judge status: Wrong Answer
a1_list = list(map(int, input().split()))
a2_list = list(map(int, input().split()))
a3_list = list(map(int, input().split()))
a1_list.extend(a2_list)
a1_list.extend(a3_list)

n = int(input())
nums = []
for _ in range(n):
  x = int(input())
  nums.append(x)
  
result = "No"
patterns = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [3, 4, 6]]
for p in patterns:
  if a1_list[p[0]] in nums and a1_list[p[1]] in nums and a1_list[p[2]] in nums:
    result = "Yes"
    break
print(result)
# Judge status: Accepted
n=int(input())
s=input()

while True:
    cum=[0]*(len(s)+1)
    for i,c in enumerate(s):
        cum[i+1]=cum[i]-1 if c==')' else cum[i]+1
    min_=min(cum)
    if min_<0:
        s='('*abs(min_)+s
        continue
    r=cum[-1]
    if r>0:
        s=s+')'*r
        continue
    print(s)
    exit()
# Judge status: Accepted
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    x=int(readline())
    flag=False
    for A in range(-200,201):
        for B in range(-200,201):
            if A**5-B**5==x:
                print(A,B)
                flag=True
        if flag:
            break

if __name__=="__main__":
    main()
# Judge status: Accepted
import math
def main():
    n=int(input())
    csf=[list(map(int,input().split())) for _ in range(n-1)]
    for i in range(n):
        if i == n-1:
            print(0)
        else:
            t=0
            for c,s,f in csf[i:]:
                t = max(s,t)
                t = math.ceil(t/f)*f+c
                #print("start:", i, t)
            print(t)

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

count = 0
arr = list(map(int, input().split()[:N]))
attack = H

for i in range(N):
    attack = attack - arr[i]
    count = count + 1
    i = i + 1

if attack <= 0 and count > 1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input()
flag = True
for i in range(3):
  if S[i] == S[i+1]:
    flag = False
if flag == True:
  print("Good")
else:
  print("Bad")
# Judge status: Accepted
A, B = map(int, input().split())

# Bの本来の高さ
B_true = (B - A) * (B - A + 1) // 2
answer = B_true - B

print(answer)
# Judge status: Accepted
n,k = map(int,input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
ans=Base_10_to_n(n,k)
print(len(ans))
# Judge status: Accepted
n = int(input())

for i in range(1,50001):
    if (i*1.08)//1 == n:
        print(i)
        exit()
    if (i*1.08)//1 > n:
        print(':(')
        exit()
# Judge status: Wrong Answer
lst_blue = []
lst_red = []
dic = {}

N = int(input())
for i in range(0,N):
  lst_blue.append(input())
M = int(input())
for i in range(0,M):
  lst_red.append(input())
  
for i in list(set(lst_blue)):
  dic[i] = int(lst_blue.count(i))

for i in lst_red:
  if i in dic:
    dic[i] -= 1
    
print(max(dic.values()))
# Judge status: Accepted
a,b = map(int, input().split())

if a >= 13:
  print(b)
elif a >= 6:
  print(b//2)
else:
  print(0)
# Judge status: Accepted
n = int(input())
plcs = [list(map(int,input().split())) for _ in range(n)]
A = [0, 0, 0]
for i in range(n):
    A = [plcs[i][j] - A[j] for j in range(3)]
    if A[0] >= abs(A[1]) + abs(A[2]) and plcs[i][0] % 2 == (abs(plcs[i][1]) + abs(plcs[i][2])) % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
N,M=map(int,input().split())
m=M//2
if N>=m:
    print(m)
else:
    print((N+m)//2)
# Judge status: Accepted
o=input()
e=input()

ans=['' for i in range(len(o)+len(e))]

count=0
for oo in o:
    ans[count] = oo
    count+=2
    
count=1
for ee in e:
    ans[count] = ee
    count+=2

print("".join(ans))
# Judge status: Wrong Answer
def get_index(n):
    i=1
    while True:
        if n<piramid(i):
            return i-1
        i+=1

def piramid(n):
    return n*(n+1)//2

n=int(input())
index=get_index(n)

print(min(index+n-piramid(index),index+2+piramid(index+1)-n))
# Judge status: Accepted
N = int(input())
S = input()
ans = 0
x = 0
for i in range(N):
  if S[i] == "I":
    x += 1
  else:
    x -= 1
  ans = max(ans,x)
print(ans)
# Judge status: Accepted
A = list(map(int,input().split()))
print(int((A[2]+ 0.5) // A[0] * A[1]))
# Judge status: Accepted
d, n = map(int, input().split())
print(100**d * (n + n//100))
# Judge status: Accepted
n,c,k = map(int,input().split())
t = sorted([int(input()) for _ in range(n)])
ans,ppl = 1,1
temp = t[0]
for v in t[1:]:
  if v-temp>k or ppl>=c:
    ans += 1
    ppl = 1
    temp = v
  else:
    ppl += 1
  #print(ans)
print(ans)
# Judge status: Wrong Answer
n = int(input())

cnt = 0
pbm = 0
for i in range(1, 10**6):
    cnt += i
    if cnt > n:
        pbm = i
        break

ans = []

for i in range(pbm, 0, -1):
    if i <= n:
        ans.append(i)
        n -= i

for i in ans:
    print(i)
# Judge status: Accepted
n = int(input())
lst = [int(input()) for i in range(5)]
mini = min(lst)
ans = (n - 1) // mini + 5
print(ans)
# Judge status: Accepted
a, b, t = map(int, input().split())

time = 1
biscuit = 0

while time < t + 0.5:
    if time % a == 0:
        biscuit += b
    time += 1

print(biscuit)
# Judge status: Accepted
from collections import defaultdict

def main():
    n = int(input())
    d = defaultdict(int)
    res = 0
    for a in input().split():
        aa = int(a)
        d[int(aa)] += 1
        res += aa

    nq = int(input())
    for q in range(nq): 
        b, c = [int(i) for i in input().split()]
        res += (c - b) * d[b]
        d[c] += d[b]
        d[b] = 0
        print(res)

if __name__ == '__main__':
    main()
# Judge status: Accepted
S = list(input())
A = [0]*(len(S)+1)

node_value = 0
for i in range(len(S)):
    if S[i] == "<":
        node_value += 1
        A[i+1] = node_value
    else:
        node_value = 0

node_value = 0
for i in range(len(S)-1,-1,-1):
    if S[i] == ">":
        node_value += 1
        A[i] = max(A[i], node_value)
    else:
        node_value = 0

print(sum(A))
# Judge status: Accepted
s = input()

zero = s.count('0')
one = s.count('1')

print(min(zero,one)*2)
# Judge status: Accepted
import random
for i in range(365):
    print(random.randint(1,26))
# Judge status: Accepted
a , b , n = map(int,input().split())
if n >= b-1:
    print(a*(b-1)//b)
elif b-1 > n:
    print(a*n//b)
# Judge status: Wrong Answer
d=[list(map(int,input().split()))for i in range(3)]
row=int(input())
num=[int(input()) for j in range(row)]
bingo=0
for a in range(3):
  if d[0][a] and d[1][a] and d[2][a] in num:
    bingo=bingo+1
  if d[a][0] and d[a][1] and d[a][1] in num:
    bingo=bingo+1
if d[1][1] and d[2][2] and d[0][0] in num:
  bingo=bingo+1
if d[0][1] and d[2][2] and d[1][0] in num:
  bingo=bingo+1
if bingo>0:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N = int(input())
D = [input().split() for _ in range(N)]
ans = "no"
for i in range(N - 2):
    if D[i][0] == D[i][1]:
         if D[i + 1][0] == D[i + 1][1]:
            if D[i + 2][0] == D[i + 2][1]:
                ans = "yes"
                break
print(ans)
# Judge status: Wrong Answer
s = input()
k = 0

def f(s):
  s += '0'
  res = 0
  ex = ''
  for i in range(len(s)):
    c = s[i]
    if c == ex:
      ex = ex+c
    else:
      res += 1
      ex = c
  return res


print(max(f(s), f(s[::-1])))
# Judge status: Wrong Answer
N=int(input())
X=list(map(int,input().split()))
for i in range(N):
  if i<N/2:
    print(X[N//2])
  else:
    print(X[N//2-1])
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
if 1 not in a:
  print(-1)
  exit()
num_break = 0
pos = 1

for i in a:
  if i == pos:
    pos += 1
  else:
    num_break += 1
# Judge status: Accepted
n = int(input())
s = list(input())
ret = []
for i in s:
  iz = ord(i) + n
  if iz > ord('Z'): iz -= 26
  ret.append(chr(iz))
print("".join(ret))
# Judge status: Wrong Answer
n = int(input())
print((n//2 + n%1)/n)
# Judge status: Wrong Answer
from collections import Counter

def resolve():
	n, k = map(int, input().split())
	a = list(map(int, input().split()))
	c = Counter(a)
	lc = len(c.keys())
	if lc > k:
		v = sum(sorted(c.values())[:k-1])
		print(v)
	else:
		print(0)
resolve()
# Judge status: Accepted
mset=set(list(input()))
aset=set(list("qazwsxedcrfvtgbyhnujmikolp"))
aset=aset-mset
lis=sorted(list(aset))
if len(lis):
    print(lis[0])
else:
    print("None")
# Judge status: Accepted
from collections import Counter
s = sorted(Counter(list(input())).values())
t = sorted(Counter(list(input())).values())
print("Yes" if s==t else "No")
# Judge status: Accepted
N,M=map(int,input().split())
l=[]
for i in range(N):
    A,B=map(int,input().split())
    l.append([A,B])
l.sort()
left_drinks=M
prices=0
for i in l:
    if left_drinks<=0:
        break
    drinks = min(i[1],left_drinks)
    left_drinks -= drinks
    prices += i[0] * drinks
print(prices)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
 
four = 0
two = 0
odd = 0
for i in A:
    if i%4 == 0:
        four += 1
    elif i%2 == 0:
        two += 1
    else:
        odd += 1
 
if two >= 1:
    odd += 1
 
if odd <= four+1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
A=int(sys.stdin.readline(2))
D=int(sys.stdin.readline(2))
if A>=1 and A<=12:
	if D>=1 and D<=12:
		print("AMBIGUOUS")
	else:
		print("MMYY")
elif D>=1 and D<=12:
	print("YYMM")
else:
	print("NA")
# Judge status: Accepted
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    A.sort()
    for i in range(N-1):
        if A[i] == A[i+1]:
            return print("NO")
    print("YES")


if __name__ == '__main__':
    main()
# Judge status: Accepted
x, y = map(int, input().split())
n = (4*x - y)/2
m = (y - 2*x)/2

if n >=0 and m >=0:

    if n == int(n) and m == int(m):
      print("Yes")
    else:
      print("No")
else:
    print("No")
# Judge status: Wrong Answer
A, B, T = map(int, input().split())
print(B * ((T + 0.5) // A))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

l=[0]*(10**5+5)
for i in a:
    l[i]+=1
p=0
for j in range(10**5):
    p=max(p,l[j]+l[j+1]+l[j+2])
print(p)
# Judge status: Accepted
s = input()
ans = "Good" if s[0] != s[1] != s[2] != s[3] else "Bad"
print(ans)
# Judge status: Accepted
a,b = map(int,input().split())
if a<=8 and b<=8:
  print("Yay!")
else:
  print(":(")
# Judge status: Accepted
M = 10 ** 6 + 5
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * M
for i in A:
    if(cnt[i] >= 2):
        continue
    for j in range(i, M, i):
        cnt[j] += 1
ans = 0
for i in A:
    if(cnt[i] == 1):
        ans += 1
print(ans)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
X = float(input())
#開業されたN個要素を受け付ける
#list = [input() for i in range(N)]
yokin = float(100)
i=0
while(yokin < X):
    yokin = yokin*1.01
    i=i+1
print(i)
# Judge status: Accepted
m = 10**9+7
n,a,b = map(int,input().split())
def c(k):
  v = 1
  w = 1
  for i in range(k):
    v = v*(n-i)%m
    w = w*(i+1)%m
  return (v*pow(w,m-2,m)%m)
print((pow(2,n,m)-1-c(a)-c(b))%m)
# Judge status: Wrong Answer
a,b = map(int, input().split())
print(int(((a+b)/2)//1))
# Judge status: Accepted
x,y=map(int,input().split())
if y==0:
    if 0>=x:
        print(-x)
    else:
        print(x+1)
elif x==0:
    if y>0:
        print(y)
    else:
        print(-y+1)
elif x*y>0:
    if y>=x:
        print(abs(abs(y)-abs(x)))
    else:
        print(abs(abs(y)-abs(x))+2)
else:
    if y<x:
        print(abs(abs(y)-abs(x))+1)
    else:
        print(abs(abs(y)-abs(x))+1)
# Judge status: Wrong Answer
n,k=map(int,input().split())
A=list(map(int,input().split()))

def culc(L):
    subL=[0]*(n+1)

    for i in range(n):
        temp=L[i]
        bottom=max(i-temp,0)
        top=min(i+temp,n-1)

        subL[bottom]+=1
        subL[top+1]-=1
    
    resL=[0]*n
    resL[0]=subL[0]
    for i in range(1,n):
        resL[i]=resL[i-1]+subL[i]

    return resL

for i in range(min(k,20)):
    A=culc(A)

print(*A)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_cnt = 0
b_cnt = 0
for i in range(n):
    if a[i] > b[i]:
        b_cnt += (a[i] - b[i])
    elif a[i] < b[i]:
        k  = (b[i] - a[i])
        if k % 2 == 0:
            a_cnt += k//2
        else:
            b_cnt += 1
            a_cnt += (k+1)//2
if a_cnt >= b_cnt:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
readline = sys.stdin.readline

N = int(readline())
INF = 10 ** 10
dp = [INF] * (N + 1)
dp[0] = 0

for i in range(10,0,-1):
  for j in range(N + 1):
    if dp[j] != INF:
      if j + 6 ** i <= N:
        dp[j + 6 ** i] = min(dp[j + 6 ** i], dp[j] + 1)
      if j + 9 ** i <= N:
        dp[j + 9 ** i] = min(dp[j + 9 ** i], dp[j] + 1)

ans = INF
for i in range(len(dp) - 1, -1, -1):
  money = dp[i] + N - i
  if ans > money:
    ans = money
        
print(ans)
# Judge status: Wrong Answer
import sys
C11,C12,C13 = map(int, input().split())
C21,C22,C23 = map(int, input().split())
C31,C32,C33 = map(int, input().split())





if (abs(C11+C22) == abs(C12 - C21)) and (abs(C12+C23) == abs(C13+C22)) and (abs(C22+C33) == abs(C23 + C32)) and (C21+C32 == C23+C32):
    print("Yes")

print("No")
# Judge status: Accepted
n, m=map(int, input().split())
ab=[list(map(int, input().split())) for _ in range(n)]
ab.sort()
ans=0
for i in range(n):
  if ab[i][1]<=m:
    ans+=ab[i][0]*ab[i][1]
    m-=ab[i][1]
  else:
    ans+=ab[i][0]*m
    break
print(ans)
# Judge status: Accepted
def main():
    n,x,y=map(int,input().split())
    Ans=[0]*n
    for i in range(1,n):
        for j in range(i+1,n+1):
            Ans[min(abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x))]+=1
    for ans in Ans[1:]:
        print(ans)
    
if __name__=='__main__':
    main()
# Judge status: Accepted
def resolve():
    N = int(input())
    A = [int(i) for i in input().split(maxsplit=N)]
    presum = [0 for _ in range(N + 1)]
    for i in range(N):
        presum[i + 1] = presum[i] + A[i]
    sumA = 0
    for i in range(1, N):
        sumA += (A[i] * (presum[i])) % (10**9 + 7)
    print(sumA % (10**9 + 7))


resolve()
# Judge status: Accepted
S = list(input())
if (S[2]==S[3]) & (S[4]==S[5]):
    print("Yes")
else:
    print("No")