peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
a = sorted(map(int,input().split()),reverse=True)
ans = 0
t = (n*3)//3
cnt = 0
i = 1 
while cnt<t:
    cnt += 1
    ans += a[i]
    i += 2
print(ans)
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
S=sum(A)
x=A[0]
y=S-x
xy_min=abs(x-y)
for i in range(1,n-1):
  x+=A[i]
  y=S-x
  xy=abs(x-y)
  if xy<xy_min:
    xy_min=xy
print(xy_min)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
k = 1
for i in range(n):
    if k == a[i]:
        k +=1
if k ==1:
    print(-1)
else:
    print(n-k+1)
# Judge status: Wrong Answer
a, b, c, d = map(int,input().split())

if int(a - b) <= d and int(b - c) <= d and int(a - c) <= d:
    print('Yes')
else :
    print('No')
# Judge status: Accepted
def main():
  n, m = input_list()
  box = [False]*n
  box[0] = True
  nums = [1]*n
  for i in range(m):
    x, y = input_list()
    if box[x-1]:
      box[y-1] = True
    nums[x-1] = nums[x-1] - 1
    nums[y-1] = nums[y-1] + 1
    if nums[x-1] == 0:
      box[x-1] = False
  print(box.count(True))
    

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

import math
main()
# Judge status: Accepted
def main():
    import sys
    ikimasu = sys.stdin.buffer.readline
    ini = lambda: int(ins())
    ina = lambda: list(map(int, ikimasu().split()))
    ins = lambda: ikimasu().strip()
    
    n = ini()
    rick = 0
    import math
    for i in range(1,n+1):
        rick+=math.floor((n-1)/i)
    print(rick)
        


    
        


        


    




















if __name__ == "__main__":
    main()
# Judge status: Accepted
n, k = map(int, input().split())
P = tuple(map(int, input().split()))
P = sorted(P)
print(sum(P[:k]))
# Judge status: Wrong Answer
n = int(input())
ans = 0
if n < 10:
  ans += n
else:
  ans += 9
  if n < 1000:
    ans += max(0, n-999)
  else:
    ans += 900
    if n < 100000:
      ans += max(0, n-99999)
    else:
      ans += 90000
print(ans)
# Judge status: Wrong Answer
n = int(input())
h = [int(e) for e in input().split()]
flg = "Yes"
equal = 0
for i in range(n-1):
    if equal:
        if h[i] > h[i+1]:
            flg = "No"
            break
    else:
        h[i] -= 1
   
        if h[i+1] < h[i]:
            flg = "No"
            break
        elif h[i+1] == h[i]:
            equal = 1

        else:
            equal = 0
print(flg)
# Judge status: Wrong Answer
#!/usr/bin/env python3

def main():
    n, m, k = map(int, input().split())
    ans = 'No'
    for i in range(n):
        for j in range(m):
            if n - i + m - j == k:
                ans = 'Yes'
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
H = list(map(int, input().split()))
H2 =[0]*(N-1)
for i in range(N-1):
    H2[i] = H[i]-H[i+1]
ans = 0
cnt = 0
for i in range(N-1):
    if H2[i] >= 0:
        cnt += 1
    elif H2[1] < 0:
        if ans < cnt:
            ans = cnt
            cnt = 0
        else:
            cnt = 0
if ans < cnt:
            ans = cnt
print(ans)
# Judge status: Accepted
from sys import stdin
l = stdin.readline().rstrip().split()

cnt5 = cnt7 = 0

for ln in range(3):
	if l[ln] == '5' : cnt5 += 1
	if l[ln] == '7' : cnt7 += 1

if cnt5 == 2 and cnt7 == 1 : print('YES')
else : print('NO')
# Judge status: Wrong Answer
import math

N = int(input())

number_of_pages = math.floor(N / 2)

print(number_of_pages)
# Judge status: Accepted
a, b = map(int, input().split())

if a <= 5:
  fare = 0
elif a <= 12:
  fare = b // 2
else:
  fare = b
  
print(fare)
# Judge status: Wrong Answer
p = input().split()
s = int(p[0])*100 + int(p[1])*10 + int(p[2])
print(s)
if s % 4 == 0:
	print("YES")
else:
	print("NO")
# Judge status: Accepted
a, b = map(int, input().split())
if a % b == 0:
  print(a // b)
else:
  print(a // b + 1)
# Judge status: Accepted
def readinput():
    n,m,k=list(map(int,input().split()))
    return n,m,k

def main(n,m,k):
    for x in range(0,m+1):
        for y in range(0,n+1):
            if (n-y)*x+y*(m-x)==k:
                return 'Yes'
    return 'No'

if __name__=='__main__':
    n,m,k=readinput()
    ans=main(n,m,k)
    print(ans)
# Judge status: Accepted
H = int(input())
memo = {}
def attack(h):
  if h in memo: return memo[h]

  if h <= 1:
    memo[h] = 1
    return memo[h]
  else:
    memo[h//2] = attack(h//2)
    return 1 + memo[h//2] + memo[h//2]

print(attack(H))
# Judge status: Accepted
N = int(input())

res = 0
for i in range(1,N+1):
    Q = (N-1)//i
    res += Q

print(res)
# Judge status: Wrong Answer
sx, sy, tx, ty = map(int, input().split())

x = ['R', 'L'] if tx - sx > 0 else ['L', 'R']
y = ['U', 'D'] if ty - tx > 0 else ['D', 'U']
abs_x = abs(tx - sx)
abs_y = abs(ty - sy)

i = 0
ans = ''
ans += y[0] * abs_y + x[0] * abs_x
ans += y[1] * abs_y + x[1] * abs_x
ans += x[1]
ans += y[0] * (abs_y + 1) + x[0] * (abs_x + 1)
ans += y[1]
ans += x[0]
ans += y[1] * (abs_y + 1) + x[1] * (abs_x + 1)
ans += y[0]
print(ans)
# Judge status: Accepted
from string import ascii_lowercase

N = int(input())
l = []

while N != 0:
    N -= 1
    l.append(N%26)
    N //= 26
print("".join(ascii_lowercase[x] for x in l[::-1]))
# Judge status: Accepted
n = int(input())
di = list(map(int, input().split()))

di.sort()

print(di[n//2] - di[n//2 - 1])
# Judge status: Accepted
import numpy as np

W, H, N = map(int, input().split())

c = np.zeros((W, H), int)

for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        c[:x, :] = 1
    elif a == 2:
        c[x:, :] = 1
    elif a == 3:
        c[:, :y] = 1
    else:
        c[:, y:] = 1

ans = W * H - np.sum(c)
print(ans)
# Judge status: Accepted
n = int(input())
li=[list(map(int,input().split())) for _ in range(n-1)]
for i in range(n-1):
    ans=li[i][1]+li[i][0]
    for j in range(i+1,n-1):
        if ans>=li[j][1]:
            if ans%li[j][2]==0:
                ans+=li[j][0]
            else:
                ans=(ans//li[j][2]+1)*li[j][2]+li[j][0]
        else:
            ans=li[j][1]+li[j][0]
    print(ans)
print("0")
# Judge status: Wrong Answer
s=list(input())
t=list(input())
if s==t[:len(s)]:
    print("Yse")
else:
    print("No")
# Judge status: Wrong Answer
N,K,S = map(int, input().split())

for i in range(K):
    print(S,end=" ")
for i in range(N-K):
    print(10**10,end=" ")
# Judge status: Accepted
N, A, B = map(int,input().split())
ans = (A+(B*(N-1)))-(B+(A*(N-1)))+1
if ans < 0:
    ans =0
print(ans)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int,input().split()))

S={}
for i in range(n):
    a = A[i]
    if a in S :
        S[a]+=1
    else:
        S[a]=1

V=list(S.values())
c = sum([v*(v-1)//2 for v in V])

cdiff=0
K=[]
for i in range(n):
    a = A[i]
    s=S[a]
    if s>=2 :
        cdiff=(s*(s-1)-(s-1)*(s-2))//2
    print(c-cdiff)
# Judge status: Accepted
s = input().split()

w = int(s[0])
a = int(s[1])
b = int(s[2])

answer = 0

if a + w < b:
    answer = b - (a + w)
else:
    answer = a - (b + w)

if (a <= b and b <= a + w) or (a <= b + w and b + w <= a + w):
    answer = 0
    
print(answer)
# Judge status: Accepted
import sys
import numpy as np

readline = sys.stdin.buffer.readline
a = np.array([])
for _ in range(3):
  a = np.append(a,list(map(int, readline().split())))
n = int(readline())

a = a.reshape(3,3)
a_2 = np.append(a,np.diag(a))
a_2 = np.append(a_2,[a[0][2],a[1][1],a[2][0]])

a_2 = a_2.reshape(5,3)
for _ in range(n):
  temp=int(readline())
  a[a==temp]=0
  a_2[a_2==temp]=0

print('Yes' if 0 in np.sum(a_2, axis=1) or 0 in np.sum(a, axis=0) else 'No')
# Judge status: Accepted
a, b, c, d, e, k = (int(input()) for _ in range(6))
print('Yay!' if abs(a-e) <= k else ':(')
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
D=dict()
s=0
for i in A:
  s+=i
  if i in D:
    D[i]+=1
  else:
    D[i]=1
for _ in range(Q):
  b,c=map(int,input().split())
  if b in D:
    s+=(c-b)*D[b]
    if c in D:
      D[c]+=D[b]
    else:
      D[c]=D[b]
  print(s)
# Judge status: Accepted
n, k = list(map(int, input().split()))

d = list()
s = set()
for _ in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        s.add(a)

c = 0
for i in range(1, n+1):
    if i not in s:
        c += 1

print(c)
# Judge status: Wrong Answer
n,k=map(int,input().split())
ans=0
for i in range(k,n+2):
  mi=i*(i-1)//2
  ma=(2*n-i-1)*i//2
  ans+=ma-mi+1
print(ans)
# Judge status: Accepted
import bisect
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = [0]+a
b = [0]+b
ans = 0
for i in range(1, n):
    a[i+1] += a[i]
for i in range(1, m):
    b[i+1] += b[i]
for i in range(n+1):
    res = k - a[i]
    if res<0: continue
    index = bisect.bisect_right(b, res)
    ans = max(ans, index+i-1)
print(ans)
# Judge status: Wrong Answer
from collections import deque
s = deque(input())
q = int(input())

flag = 1
for i in range(q):
  st = input().split()
  if int(st[0]) == 1:
    flag *= -1
  else:
    tmp = int(st[1])*flag
    if tmp == 1 or -2:
      s.appendleft(st[2])
    else:
      s.append(st[2])

if flag == -1:
  s.reverse()
print(''.join(s))
# Judge status: Wrong Answer
S = input().split(" ")
N = int(S[0])
K = int(S[1])
ARR = input().split(" ")



import re
import math

def calculate(n,k,arr):
    miniest = int(min(arr))

    s = "".join(arr)
    brr = re.split(str(miniest)+'{1,}',s)

    counts = 0

    for br in brr:
        counts += math.ceil(len(br) / (k-1))

    return counts

result = calculate(N,K,ARR)

print(result)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
print(max(a*d, a*c, b*c, b*d))
# Judge status: Accepted
K, X = map(int, input().split())

print("Yes" if 500 * K >= X else "No")
# Judge status: Accepted
inf = pow(10,9)+ 7

n=int(input())
if n==1:
  print(0)
elif n==2:
  print(2)
else:
  f=pow(10,n,inf) - 2*pow(9,n,inf) + pow(8,n,inf)
  print(f%inf)
# Judge status: Accepted
def resolve():
    '''
    code here
    '''
    import sys
    N = int(input())
    S = sys.stdin.readline().strip()
    mod = pow(10, 9) + 7
    set_S = set([item for item in S])
    res = 1

    for s in set_S:
        cnt = 1
        for letter in S:
            if s == letter:
                cnt += 1
        res *= cnt
        res %= mod

    mod = pow(10, 9) + 7
    print(res-1)

if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
L = []
for i in range(M):
  B, C = map(int, input().split())
  L.append([C, B])
L.sort(reverse=True)
S = [0 for i in range(N)]
i, j = 0, 0
while j < N and i < len(L):
  if j+L[i][1] < N:
    for k in range(L[i][1]):
      S[j+k] = L[i][0]
    j += L[i][1]
  else:
    for k in range(j, N):
      S[k] = L[i][0]
  i += 1
print(sum(max(S[i], A[i]) for i in range(N)))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
m = 0

for i in range(n):
  m += b[a[i]-1]
  if i==0:
    continue
  elif i==n-1:
    continue
  if a[i] == a[i-1]+1:
    m += c[i-1]
    
print(m)
# Judge status: Wrong Answer
import bisect
n = int(input())
ARR = list(map(int,input().split()))
arr =ARR[::-1]

lis =[arr[0]]

for i in range(1,n):
     pos = bisect.bisect_right(lis,arr[i])
     if arr[i] >=lis[-1]:
          lis.append(arr[i])
     else:
          lis[pos]=arr[i]
print(len(lis))
# Judge status: Wrong Answer
n = int(input())
a = [int(i) for i in input().split()]
 
m_cost = 10 ** 5
for i in range(min(a), max(a)+1):
    cost = 0
    for j in range(n):
        cost += (a[j] - i) ** 2
    m_cost = min(m_cost, cost)
print(m_cost)
# Judge status: Wrong Answer
a, b, c = [int(i) for i in input().split()]
if a < c < b:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a=input()
b=input()[::-1]
if a==b:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
import math

N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

for Z in range(-100, 101, 1):
  if X < Z and Z <= Y and max(x) < Z and min(y) >= Z:
    print('No War')
  else:
    print('War')
# Judge status: Accepted
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
N = int(input())

b = 111
if N <= b :
  print (b)
  exit()

while N-b > 111 :
  b += 111
b += 111
print (b)
# Judge status: Accepted
n=int(input())
list=input().split()
sum=0
for i in range(n):
 sum+=int(list[i])
sum=sum*sum
sum2=0
for i in range(n):
 sum2+=int(list[i])*int(list[i])
sum-=sum2
sum//=2
sum%=1000000007
print(int(sum))
# Judge status: Accepted
n,k = map(int,input().split())
A = list(map(int,input().split()))
#print(A)
L = []
ave = sum(A[:k])

L.append(ave)

for i in range(n-k):
    #print(A[i],A[k+i])
    ave = ave - A[i] + A[k+i]
    L.append(ave)

for i in range(len(L)-1):
    if L[i] < L[i+1]:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
import math
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
print(math.ceil(a/10)+math.ceil(b/10)+math.ceil(c/10)+math.ceil(d/10)+math.ceil(e/10))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
M = max(A)+1
cnt = [0]*M
ans = 0
for a in A:
    if cnt[a] != 0:
        cnt[a] = 2
    else:
        for i in range(a, M, a):
            cnt[i] += 1
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)
# Judge status: Accepted
A, B = map(int,input().split())

if A > 9 or B > 9:
    print(-1)
else:
    print(A * B)
# Judge status: Accepted
# -*- coding: utf-8 -*-
d, n = map(int,input().split())

if d == 0:
    if n <= 99:
        print(n)
    else:
        print(101)
if d == 1:
    if n <= 99:
        print(n * 100)
    else:
        print(10100)
if d == 2:
    if n <= 99:
        print(n * 10000)
    else:
        print(1010000)
# Judge status: Wrong Answer
a = input()
b = input()+""
for c,d in zip(a,b):
  print(c+d,end="")
# Judge status: Wrong Answer
n, k = map(int, input().split())

MOD = 1e9+7

def a(m):
    s0 = 1
    s1 = (m * (n+1)) % MOD
    s2 = (m * m) % MOD
    
    return s1 - s2 + s0

s = [0] * (n+2)
for i in range(1,n+2):
    #print(i,a(i))
    s[i] = s[i-1] + a(i)

print(int(s[n+1] - s[k-1]))
# Judge status: Accepted
n = int(input())
a,b = map(int,input().split())
#L = list(map(int,input().split()))
for i in range(a,b+1):
    if i%n == 0:
        print("OK")
        exit()
print("NG")
# Judge status: Accepted
d=dict()
wa=ans=0
N,M=map(int,input().split())
for i in range(M):
  p,s=input().split()
  if p not in d:
    d[p]=0
  if d[p]>=0 and s=="AC":
    ans+=1
    wa+=d[p]
    d[p]=-float("inf")
  else:
    d[p]+=1
print(ans,wa)
# Judge status: Wrong Answer
n,k = map(int, input().split())
x = list(map(int, input().split()))

ans=10**12
for i in range(n):
  if i+k <= n:
    t=x[i:i+k]
    if min(t)*max(t) > 0:
      ans=min(ans, abs(max(t)))
    else:
      ans=min(ans,min(abs(min(t)),max(t))*2+max(abs(min(t)),max(t)))
    
print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print('Yes' if a<=c<=c else 'No')
# Judge status: Wrong Answer
n = int(input())
ans = 0
for i in range(n):
  if i**2<=n:
    ans = i**2
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(n):
  if (i+1)%2!=0:
    if a[i]%2!=0:
      count+=1
      
print(count)
# Judge status: Wrong Answer
x=int(input())
if(x>=30):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import sys
input = sys.stdin.readline

N = int(input())
xy = [[int(i) for i in input().split()] for _ in range(N)]

d1 = []
d2 = []
for x, y in xy :
  d1.append(x + y)
  d2.append(x - y)

d1.sort(reverse=True)
d2.sort(reverse=True)

print(max(
  d1[0] - d1[-1],
  d2[0] - d2[-1],
))
# Judge status: Accepted
from collections import Counter
s = input()
s_counter = Counter(s)
s = [0]*3
s[0] = s_counter["a"]
s[1] = s_counter["b"]
s[2] = s_counter["c"]
if max(s)-min(s) >= 2:
    print("NO")
else:
    print("YES")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
D = [tuple(map(int, input().split())) for _ in range(N)]

for i in range(N-3):
    if D[i][0]==D[i][1] and D[i+1][0]==D[i+1][1] and D[i+2][0]==D[i+2][1]:
        print('Yes')
        exit()

print('No')
# Judge status: Wrong Answer
n = int(input())

c = 0

ans = 'No'
for i in range(15):
    for j in range(26):
        c = 4 * j + 7 * i
    if n == c:
        ans = 'Yes'
        break
print(ans)
# Judge status: Accepted
#D-Not Divisible
#pdf見た
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
maxi = a[-1]
boo = [True]*(maxi+1)

for i in range(n):
    k = a[i]
    if not boo[k]:
        continue
    if i != n-1 and k == a[i+1]:
        boo[k] = False
    for j in range(2,maxi//k+1):
        boo[k*j] = False
    
count = 0
for k in a:
    if boo[k] == True:
        count += 1

print(count)
# Judge status: Accepted
n = int(input())
listA = list(map(int, input().split()))

count = 0
for i in range(len(listA)):
    if (i+1)%2 == 1 and listA[i]%2 == 1:
        count+=1
print(count)
# Judge status: Accepted
print(7 - {w:i for w, i in zip(('SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'), range(7))}[input()])
# Judge status: Wrong Answer
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

a4 = len(a[a % 4 == 0])
a2n = len(a[a % 2 != 0])
a2 = len(a[a % 2 == 0])

print("Yes" if a4 + 1 + a2 // 2 >= a2n+1 else "No")
# Judge status: Accepted
s = input()
n = len(s)
a = [i for i in s]
for i in range(2**(n-1)):
  b = []
  for j in range(n):
    b.append(a[j])
    if j > 2:
      break
    if (i >> j) & 1:
      b.append("+")
    else:
      b.append("-")
  if eval("".join(b)) == 7:
    b.append("=7")
    print("".join(b))
    exit()
# Judge status: Wrong Answer
N = int(input())
A = [0 for _ in range(N)]
for i in range(N-1):
  c, s, f = map(int, input().split())
  for j in range(i+1):
    if A[j] < s:
      A[j] = s + c
    else:
      d = - (s - A[j]) // f
      A[j] = s + f * d + c
for i in range(N):
  print(A[i])
# Judge status: Wrong Answer
l=list(map(int,input().split()))
if(sum(l)%3==0):
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
import sys
from pprint import pprint

def solve(s, t, a, b, u):
    if u == s:
        a -= 1
    if u == t:
        b -= 1
    print(a, b)

if __name__ == '__main__':
    s, t = sys.stdin.readline().strip().split(" ")
    a, b = map(int, sys.stdin.readline().strip().split(" "))
    u = sys.stdin.readline().strip()
    solve(s, t, a, b, u)
# Judge status: Accepted
def main():
  n = int(input())
  print((1000 - n) % 1000)


if __name__ == "__main__":
  main()
# Judge status: Accepted
nn = int(input())
dd = list(map(int,input().split()))
nof_op = 0
finish = 0
while True:
    for ind in range(nn):
        if (dd[ind] % 2) == 1:
            finish = 1
            break
        else:
            dd[ind] = dd[ind] / 2
    if finish == 1:
        break
    else:
        nof_op += 1
print(nof_op)
# Judge status: Accepted
n = int(input())
s = input()
ans = [chr(ord(s_)+n) if (ord(s_)+n)<91 else chr((ord(s_)+n)-26) for s_ in s ]
print(''.join(ans))
# Judge status: Accepted
D, N = map(int,input().split())
if N % 100 == 0: N += 1
print(N * 100 ** D)
# Judge status: Accepted
N = int(input())
S = input()
l = 0
r = 0
for c in S:
    if c == '(':
        l += 1
    else:
        if l != 0:
            l -= 1
        else:
            r += 1
print('('*r + S + ')'*l)
# Judge status: Wrong Answer
import bisect

n = int(input())
l = sorted(list(map(int,input().split())))
print(l)
count = 0
for i in range(2,n):
	for j in range(1,i):
		count += max(j - bisect.bisect_right(l, l[i] - l[j]) , 0)

		print(l[j],l[i],bisect.bisect_right(l,l[i]-l[j]),count)
# Judge status: Accepted
n=int(input())
s=input()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b

for i in range(n):
    for d in range(n):
        j=i+d
        k=j+d
        if k>=n:
            break
        if (s[i]!=s[j]) & (s[j]!=s[k]) & (s[k]!=s[i]):
            ans-=1

print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
a = list(map(int, input().split()))

sum_v = sum(a)
border = sum_v / (4*m)
count = 0
for i in a:
    if i >= border:
        count += 1
if count >= m:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n=input()
print(len([a for a in list(map(int,input().split()))[::2] if a%2]))
# Judge status: Accepted
n,m = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(m)]

ball = [1] * (n+1)
red = [0] * (n+1)
red[1] = 1

for x,y in xy:
    ball[x] -= 1
    ball[y] += 1
    if red[x] == 1:
        red[y] = 1
        if ball[x] == 0:
            red[x] = 0
print(sum(red))
# Judge status: Wrong Answer
s = input()
print('Heisei' if s<='2019/4/30' else 'TBD')
# Judge status: Accepted
N = int(input())

T = 0
X = 0
Y = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if (t - T) < abs(x-X) + abs(y-Y) or ((t - T) + abs(x-X) + abs(y-Y))%2 == 1:
        print("No")
        break
    T = t
    X = x
    Y = y
else:
    print("Yes")
# Judge status: Accepted
def main():
    N, K = (int(i) for i in input().split())
    a = N - (N//K)*K
    print(min(a, abs(a-K)))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, A, B, C, D = map(int, input().split())
A, B, C, D = A-1, B-1, C-1, D-1
S = input()

if C > D:
    print('Yes' if '...' in S[B-1:D+2] and '##' not in S[A:C] else 'No')
else:
    print('Yes' if '##' not in S[A:D] else 'No')
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))
c = 0

for i in range(1,n - 1):
    if p[i - 1] < p[i] and p[i] < p[i + 1]:
        c = c + 1

print(c)
# Judge status: Accepted
n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]
h.sort()
ans=float('inf')
for i in range(n-k+1):
    tmp=h[i+k-1]-h[i]
    ans=min(tmp,ans)
print(ans)
# Judge status: Accepted
A, B, K = map(int, input().split())
L = set()
for i in range(A, A+K):
  if i <= B:
    L.add(i)
for i in range(B, B-K, -1):
  if i >= A:
    L.add(i)
print(*sorted(list(L)), sep="\n")
# Judge status: Accepted
from itertools import accumulate

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0] + list(accumulate(A))
    MOD = 10 ** 9 + 7
    ans = 0
    for i in range(N):
        ans += A[i] * (B[N] - B[i+1])
        ans %= MOD

    print(ans)




if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
A, B = [], []
for i in range(n):
	a, b = map(int, input().split())
	A.append(a)
	B.append(b)

A = A[::-1]
B = B[::-1]

cnt = 0
for i in range(n):
	print(B[i] - (cnt + A[i]) % B[i])
	if (cnt + A[i]) % B[i] == 0:
		continue
	else:
		cnt += B[i] - (cnt + A[i]) % B[i]

print(cnt)
# Judge status: Accepted
N = int(input())
num = [0]*N
for i in range(1,10**2 + 1):
    for j in range(1,10**2 + 1):
        for k in range(1,10**2 + 1):
            ans = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if ans <= N:
                num[ans - 1] += 1
for i in range(N):
    print(num[i])
# Judge status: Accepted
# https://atcoder.jp/contests/keyence2020/tasks/keyence2020_b
n = int(input())
robots = []
for _ in range(n):
    x, l = map(int, input().split())
    a, b = x - l, x + l
    robots.append((a, b))

robots.sort(key=lambda x: x[1])

t = 0
pre = robots[0][1]
for i in range(1, n):
    a, b = robots[i]
    if a < pre:
        t += 1
    else:
        pre = b
ans = n - t
print(ans)
# Judge status: Accepted
import numpy as np
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

i = 0
while 1:
    A = A / 2
    if np.all(A.astype(np.int) == A):
        i += 1
    else:
        break
    
print(i)
# Judge status: Accepted
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
MOD = 10**9 + 7
 
dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1 if 1 not in a else 0
 
a = set(list(range(2,N+1))) - set(a)
for i in a:
    dp[i] = (dp[i-1] + dp[i-2]) % MOD
print(dp[N] % MOD)
# Judge status: Wrong Answer
N,A,B=map(int,input().split())

if N==1:
  if A==B:
    print(1)
  else:
    print(0)
elif A==B:
  print(N)
elif A>B:
  print(0)
else:
  print(B*(N-2)-A*(N-2)+1)