Harryxun/stf_run huggingface dataset:
N, K = map(int,input().split())
p = map(int,input().split())
newlist = sorted(p, reverse=False)
ans_list=[]
for i in range(1,K+1):
    ans.append(newlist[i-1])
print(sum(ans_list))


### FIXED CODE ###

N, K = map(int,input().split())
p = map(int,input().split())
newlist = sorted(p, reverse=False)
ans_list=[]
for i in range(1,K+1):
    ans_list.append(newlist[i-1])
print(sum(ans_list))
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
t=0
while True:
  maxi=A[0]
  if len(A)>1 :
    maxi_2=A[1]
    t+=1
    maxi=maxi//2
    if t==M :
      A[0]=maxi
      break
    elif maxi_2>maxi :
      A[0]=maxi_2
      A[1]=maxi
      for i in range(1,N):
        if A[i]<A[i+1]:
          A[i]=A[i+1]
          A[i+1]=maxi
        else:
          break     
      continue
    else:
      continue
  else :
    maxi=maxi//(2**M)
    A[0]=maxi
    break

amount=sum(A)
print(amount)

### FIXED CODE ###

s=input()

if s=="Sunny":
  a="Cloudy"
elif s=="Cloudy":
  a="Rainy"
else:
  a="Sunny"
  
print(a)
n=int(input())
s=input()
c=0
for i in range(1,N):
  x=s[0:i]
  y=s[i:N]
  for j in range('a','z'+1):
    if j in x and j in y:
      c+=1
print(c)

### FIXED CODE ###

n=int(input())
s=input()
c=0
for i in range(1,n):
  x=set(s[:i])
  y=set(s[i:])
  a = len(x & y)
  if a > c:
    c = a
print(c)
a = input()
b = input()
print(a + b)

### FIXED CODE ###

a, b = input().split( )
a = int(a)
b = int(b)
print(str(a*b) + ' ' + str(2*(a+b)))
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
lastindex=0
tenmod=[a%10,b%10,c%10,d%10,e%10]
times=tenmod.count(0)
for i in range(times):
  tenmod.remove(0)
key=min(tenmod)
alltime=0
for i in range(5):
  if l[i]%10==0:
    alltime+=l[i]
  elif l[i]%10==key:
    alltime+=l[i]
  else:
    alltime+=int(l[i]/10)*10+10
print(alltime)


### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
lastindex=0
tenmod=[a%10,b%10,c%10,d%10,e%10]
times=tenmod.count(0)
if times!=0:
  for i in range(times):
    tenmod.remove(0)
if times!=5:
  key=min(tenmod)
else:
  key=0
alltime=0
lastflag=0
for i in range(5):
  if l[i]%10==0:
    alltime+=l[i]
  elif l[i]%10==key and lastflag==0:
    alltime+=l[i]
    lastflag+=1
  else:
    alltime+=int(l[i]/10)*10+10
print(alltime)
import sympy
N=int(input())
S=sympy.divisors(N)
ans=0
S=S[1:]
for i in S:
   if i==0:
      continue
   if N%(i-1)==N//(i-1):
      ans+=i-1
print(ans)

### FIXED CODE ###

N=int(input())
def div(n):
    low,high= [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            low.append(i)
            if i != n // i:
                high.append(n//i)
        i += 1
    return low+high[::-1]
S=div(N)
ans=0
S=S[1:]
for i in S:
   if i==0:
      continue
   if N%(i-1)==N//(i-1):
      ans+=i-1
print(ans)
N, M = [map(int, input(.split()))]

works = [map(int, input().split())]

ans = N

for i in range(M):
    ans -= works[i]

if ans < 0:
    print('-1')
else:
    print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
works = list(map(int,input().split()))

if N >= sum(works):
  print(N - sum(works))
else:
  print("-1")
c = input()
import string
alphStr = string.ascii_lowercase
print(alphStr.index(c)[alph+1])


### FIXED CODE ###

c = input()
import string
alphStr = string.ascii_lowercase
alph = alphStr.index(c)
print(alphStr[alph+1])
N = [int(i) for i in input().split()][0]

balls=[]
for i in range(N):
  balls.append( [int(i) for i in input().split()])

salist=[]
for i in range(1,len(balls),1):
  for j in range(i,len(balls),1):
    sax = balls[i][0]-balls[j-1][0]
    say = balls[i][1]-balls[j-1][1]
    salist.append([sax,say])

balls.reverse()
costs=[]
for i,sa in enumerate(reversed(salist)):
  cost=1
  for i in range(0,len(balls)-1,1):
    if balls[i+1][0]!=balls[i][0]-sa[0] and balls[i+1][1]!=balls[i][1]-sa[1]:
      cost+=1
  costs.append(cost)

print(min(costs))

### FIXED CODE ###

N = [int(i) for i in input().split()][0]

balls=[]
for i in range(N):
  balls.append( [int(i) for i in input().split()])

ans=0
for i in range(0,N-1):
  for j in range(i+1,N):
    sax = balls[j][0]-balls[i][0]
    say = balls[j][1]-balls[i][1]
    merge=0
    for k in range(0,N):
      if([balls[k][0]+sax,balls[k][1]+say] in balls):
          merge+=1
    ans=max(ans,merge)
print(N-ans)
n=int(input())
a=input().split()
ans=""
for i in range(n-1,-1,-2):
  ans+=a[i]
for i in range(n%a,n,2):
  ans+=a[i]
print(ans)

### FIXED CODE ###

n=int(input())
a=input().split()
ans=""
for i in range(n-1,-1,-2):
  ans+=a[i]+" "
for i in range(n%2,n,2):
  ans+=a[i]+" "
print(ans)
import math

def comb(n, r):
  if n >=r:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  else:
    return 0
      
n,m = map(int,input().split())
a = [0]*m
b = [0]*m
for i in range(m):
  u,v = map(int, input().split())
  a[i] = u-1
  b[i] = v-1
par = [i for i in range(n)]
size = [1]*n
incomb = [comb(n,2)]*m

def root(x):
  if par[x] == x: 
    return x
  else:
    par[x] = root(par[x])
    return par[x]
    
def isSame(x,y):
  return par[x] == par[y]

def union(x,y):
  x = root(x)
  y = root(y)
  if x == y:
    return
  else:
    par[y] = x
    size[x] += size[y]
    
def size_count(x):
  return size[root(x)]

for i in reversed(range(1,m)):
  q_a = a[i]
  q_b = b[i]
  size_a = size_count(q_a)
  size_b = size_count(q_b)
  if not isSame(q_a,q_b):
    union(q_a,q_b)
    incomb[i-1] = incomb[i] - size_a*size_b
  else:
    incomb[i-1] = incomb[i]

for i in incomb:
  print(i)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
n,m = map(int,input().split())
a = [0]*m
b = [0]*m
for i in range(m):
  u,v = map(int, input().split())
  a[i] = u-1
  b[i] = v-1
par = [i for i in range(n)]
size = [1]*n
incomb = [n*(n-1)//2]*m

def root(x):
  if par[x] == x: 
    return x
  else:
    par[x] = root(par[x])
    return par[x]
    
def isSame(x,y):
  return par[x] == par[y]

def union(x,y):
  x = root(x)
  y = root(y)
  if x == y:
    return
  else:
    par[y] = x
    size[x] += size[y]
    
def size_count(x):
  return size[root(x)]

for i in reversed(range(1,m)):
  q_a = a[i]
  q_b = b[i]
  size_a = size_count(q_a)
  size_b = size_count(q_b)
  if not isSame(q_a,q_b):
    union(q_a,q_b)
    incomb[i-1] = incomb[i] - size_a*size_b
  else:
    incomb[i-1] = incomb[i]

for i in incomb:
  print(i)
import sys

def main():
    input = sys.stdin.readline
    n, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    key = 30
    nn = n
    while nn > 0:
        key += 1
        nn //= 2
    
    for _ in range(min([key, k])):
        b = [0]*n
        for i in range(n):
            l, r = max([i-a[i], 0]), min([i+a[i], n-1])
            b[l] += 1
            if r != n-1:
                b[r+1] -= 1
        for i in range(n):
            a[i] = 0
            a[i] += b[i]
            if i != 0:
                 a[i] += a[i-1]
    print(*a)

if __name__ == "__main__":
    main()


### FIXED CODE ###

s = input()
print(s[:3])
import sys
N = int(input())
ipt = list(input())
stR = ["S" for i in range(N)]

def sheep(stg):
     return stg
def wolf(stg):
    if stg == "S":
        return "W"
    else:
        return "S"
def modN (i):
    return i%N
def check ( num1,num2 ):
    
    for i in range(N+2):
        if stR[modN(i+1)] == "S" and ipt[modN(i+1)]=="o"  :
            stR[modN(i+2)]=sheep(stR[modN(i)])
        elif stR[modN(i+1)] == "W" and ipt[modN(i+1)]=="x":
            stR[modN(i+2)]=sheep(stR[modN(i)])
        else:
            stR[modN(i+2)]=wolf(stR[modN(i)])
    
    if stR[0]==num1 and stR[1]==num2:
        print("".join(stR))
        return True
    else:
        return False

if check("S","W"):
    sys.exit()
else:
    stR[0]="W"
    if check("W","W"):
        sys.exit()
    else:
        stR[1]="S"
        if check("W","S"):
            sys.exit()
        else:
            stR[0]="S"
            if check("S","S"):
                sys.exit()
            else:
                print(-1)

### FIXED CODE ###

N = int(input())
print(N*800-200*(N//15))
strList = [input().split()]
rgb = int(join(strList))
if rgb % 4 == 0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

r, g, b = input().split()
rgb = r + g + b
if int(rgb) % 4 == 0:
    print("YES")
else:
    print("NO")
import collections
print 'AC' if ( r[0] == 'A' and  collections.Counter(r[2:-1])['C'] == 1 and  all([l in set(['A', 'C']) or l.lower() ==l for l in r ])) else 'WA'

### FIXED CODE ###

"""
1. The initial character of S is an uppercase A.
2. There is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).
3. All letters except the A and C mentioned above are lowercase.
"""
import collections
def a(r): return r[0] == 'A'
def b(r): return collections.Counter(r[2:-1])['C'] == 1
def c(r): return all([l in set(['A', 'C']) or l.lower() ==l for l in r ])
def f(r):  return a(r) and b(r) and c(r)

print 'AC' if f(raw_input()) else 'WA'
N = int(input())
a = list(map(int, input().split()))
colors = [0] * 9
for i in range(N):
    if 1 <= a[i] and a[i] <= 399:
        colors[0] = 1
    elif 400 <= a[i] and a[i] <= 799:
        colors[1] = 1
    elif 800 <= a[i] and a[i] <= 1199:
        colors[2] = 1
    elif 1200 <= a[i] and a[i] <= 1599:
        colors[3] = 1
    elif 1600 <= a[i] and a[i] <= 1999:
        colors[4] = 1
    elif 2000 <= a[i] and a[i] <= 2399:
        colors[5] = 1
    elif 2400 <= a[i] and a[i] <= 2799:
        colors[6] = 1
    elif 2800 <= a[i] and a[i] <= 3199:
        colors[7] = 1
    else:
        colors[8] += 1
if sum(colors[0:8] == 0) and colors[9] >= 1:
    MIN = 1
else:
    MIN = sum(colors[0:8])
MAX = sum(colors)

print(MIN, MAX)


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
colors = [0] * 9
for i in range(N):
    if 1 <= a[i] and a[i] <= 399:
        colors[0] = 1
    elif 400 <= a[i] and a[i] <= 799:
        colors[1] = 1
    elif 800 <= a[i] and a[i] <= 1199:
        colors[2] = 1
    elif 1200 <= a[i] and a[i] <= 1599:
        colors[3] = 1
    elif 1600 <= a[i] and a[i] <= 1999:
        colors[4] = 1
    elif 2000 <= a[i] and a[i] <= 2399:
        colors[5] = 1
    elif 2400 <= a[i] and a[i] <= 2799:
        colors[6] = 1
    elif 2800 <= a[i] and a[i] <= 3199:
        colors[7] = 1
    else:
        colors[8] += 1

if sum(colors[0:8]) == 0 and colors[8] >= 1:
    MIN = 1
else:
    MIN = sum(colors[0:8])
MAX = sum(colors)

print(MIN, MAX)
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s); sys.stdout.write('\n')
def wi(n): sys.stdout.write(str(n)); sys.stdout.write('\n')
def wia(a, sep=' '): sys.stdout.write(sep.join([str(x) for x in a])); sys.stdout.write('\n')


def main():
    n = ri()
    for nn in range(1, n+1):
        s = int(nn**0.5) + 2
        cnt = 0
        for x in range(1, s):
            for y in range(1, s):
                r1 = x*x + y*y + x*y
                if r1 > nn:
                    break
                for z in range(1, s):
                    r = x*x + y*y + z*z + x*y + y*z + z*x
                    if r > nn:
                        break
                    if r == nn:
                        cnt += 1
        wi(cnt)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s); sys.stdout.write('\n')
def wi(n): sys.stdout.write(str(n)); sys.stdout.write('\n')
def wia(a, sep=' '): sys.stdout.write(sep.join([str(x) for x in a])); sys.stdout.write('\n')


def main():
    l, r, d = ria()
    cnt = 0
    for x in range(l, r+1):
        if x % d == 0:
            cnt += 1
    wi(cnt)


if __name__ == '__main__':
    main()
s = int(input())
f = input()
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in f:
  ans += a[a.index(i)+s]

print(ans)

### FIXED CODE ###

s = int(input())
f = input()
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in f:
  ans += a[a.index(i)+s]

print(ans)
N = int(input())
nn = N
K = int(input())
n = 1
st = []
m = min(N, K)
while N >= abs(nn - n * m) :
    N = abs(N - K)
    n = n + 1
    st.append(N)
    a = min(st)
print(min(m, a))


### FIXED CODE ###

a = list(map(int,input().split()))
n,k = a
ans = 0
if n > k:
    ans = n % k
    if k - ans < ans:
        ans = k - ans
else:
    ans = k - n
    if ans > n:
        ans = n
print (ans)
from numba import njit

#@njit('i8(i8)', cache=True)
def popcount(n):
    a = 0
    while n != 0:
        a += n & 1
        n >>= 1
    return a

#@njit('i8(i8)', cache=True)
def fun(n):
    ops = 0
    while n:
        pc = popcount(n)
        n %= pc
        ops += 1
    return ops

n = int(input())
xs = list(map(int, input()))

from functools import reduce
sm = reduce(lambda x,y: x*2+y, xs)
pc = xs.count(1)

# pcの差分を出した後の剰余計算を速くするため、事前にmod pc+1, mod pc-1を計算しておく
mp = sm % (pc + 1)
mm = sm % (pc - 1) if pc > 0 else 0

for i in range(n):
    df = 1 if xs[i] == 0 else -1
    pci = pc + df
    if pci == 0:
        print(0)
        continue

    rest = pow(2, n - i - 1, pci)

    if xs[i] == 0:
        smi = (mp + rest) % pci
        print(1 + fun(smi))
    else:
        smi = (mm - rest) % pci
        print(1 + fun(smi))



### FIXED CODE ###

from numba import njit

@njit('i8(i8)', cache=True)
def popcount(n):
    a = 0
    while n != 0:
        a += n & 1
        n >>= 1
    return a

@njit('i8(i8)', cache=True)
def fun(n):
    ops = 0
    while n:
        pc = popcount(n)
        n %= pc
        ops += 1
    return ops

n = int(input())
xs = list(map(int, input()))

from functools import reduce
sm = reduce(lambda x,y: x*2+y, xs)
pc = xs.count(1)

# pcの差分を出した後の剰余計算を速くするため、事前にmod pc+1, mod pc-1を計算しておく
mp = sm % (pc + 1)
mm = sm % (pc - 1) if pc > 1 else 0

for i in range(n):
    df = 1 if xs[i] == 0 else -1
    pci = pc + df
    if pci == 0:
        print(0)
        continue

    rest = pow(2, n - i - 1, pci)

    if xs[i] == 0:
        smi = (mp + rest) % pci
        print(1 + fun(smi))
    else:
        smi = (mm - rest) % pci
        print(1 + fun(smi))
R = int(input())

if R >= 2800:
    peint("AGC")
elif R >= 1200:
    print("ARC")
else:
    print("ABC")

### FIXED CODE ###

R = int(input())

if R >= 2800:
    print("AGC")
elif R >= 1200:
    print("ARC")
else:
    print("ABC")
mport math

def prime_function(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a

A,B=map(int,input().split())
GCD=math.gcd(A,B)
print(len(set(prime_function(GCD)))+1)







### FIXED CODE ###

import fractions

def prime_function(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a

A,B=map(int,input().split())
GCD=fractions.gcd(A,B)
print(len(set(prime_function(GCD)))+1)
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
H = list(map(int, input().split()))

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    for i in range(0, K):
        H.pop(i)

    print(sum(H))

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, K = map(int, input().split())
H = list(map(int, input().split()))

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    print(sum(H[K:]))
_ = int(input())
kakaku = list(map(int, input().split()))

money = 1000
num_item = 0

up_flag = False
down_flag = False

if kakaku[0] < kakaku[1]:
    up_flag = True
else:
    down_flag = True

dp = []

if up_flag:
    dp.append(kakaku[0])

# 減=>増=>減....の形にする
for i in range(1, len(kakaku)):
    # いま増加中or下後中
    if kakaku[i - 1] > kakaku[i]:
        if down_flag:
            pass
        else:
            down_flag=True
            up_flag=False
            dp.append(kakaku[i-1])
        down_flag = True
    elif kakaku[i-1] < kakaku[i]:
        if up_flag:
            pass
        else:
            down_flag = False
            up_flag = True
            dp.append(kakaku[i-1])
        up_flag = True
    # print('up', up_flag, 'down', down_flag, 'now item',kakaku[i], 'dp', dp)

if kakaku[-2] < kakaku[-1]:
    if kakaku[-3] < kakaku[-2]:
        dp[-1] = kakaku[-1]
    else:
        dp.append(kakaku[-1])

# print(dp)

for i in range(len(dp)):
    if i % 2 == 0:
        num_item += money // dp[i]
        money -= dp[i] * num_item
    else:
        money += dp[i] * num_item
        num_item = 0
if num_item != 0:
    money += num_item * dp[-1]

print(money)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
money = 1000
stock = 0
 
for i in range(N):
    if i == N-1:
        money += stock * A[i]
        break
    if A[i] < A[i+1]:
        tmp_stock = money // A[i]
        stock += tmp_stock
        money -= tmp_stock * A[i]
    elif A[i] > A[i+1]:
        money += stock * A[i]
        stock = 0
    else:
        pass
 
print(money)
S = input()

listed_S = list[S]
if len(listed_S)==2:
    print(S)
elif len(listed_S)==3:
    print(S[::-1])

### FIXED CODE ###

S = input()

listed_S = list(S)
if len(listed_S)==2:
    print(S)
elif len(listed_S)==3:
    print(S[::-1])
a = input()
b = input().split()
result = 1
for i in range(int(a)):
    result = result * int(b[i])
if result > 1000000000000000000:
    print(-1)
else:
    print(result)

### FIXED CODE ###

num = input()
item = num.split(  )
result = int(item[1]) *  int(item[0])
print(result)
from collections import Counter
import sys
input = sys.stdin.readline
n = int(input())
str_list = [input() for i in range(n)]
counter_list = [Counter[i] for i in str_list]
ans = 0
for i in range(n):
  first = Counter(str_list[i])
  for j in range(n-i-1):
    second = Counter(str_list[j+i+1])
    if first == second:
      ans +=1
print(ans)

### FIXED CODE ###

from collections import Counter
import sys

input = sys.stdin.readline
n = int(input())
str_list = [''.join(sorted(input().rstrip())) for i in range(n)]
ans = 0
count_list = list(Counter(str_list).values())
for i in count_list:
  sum = 0
  for j in range(int(i)):
    sum += j
  ans +=sum
print(ans)
import bisect

n,k = map(int, input().split())
d = list(map(int, input().split()))
num = [ i for i in range(10)]
num += d
a = [ x for x in set(num) if num.count(x)<2]
s = str(n)
m = len(s)
ans = []
for i in range(m):
    x = int(s[i])
    index = bisect.bisect_left(a,x)
    if a[index]==x:
        ans.append(str(x))
    else:
        ans.append(str(a[index]))
        for j in range(m-i-1):
            ans.append(str(a[0]))
        break
print("".join(ans))

### FIXED CODE ###

n,k = map(int, input().split())
d = list(input().split())
ans = n
while True:
    flag = False
    a = list(str(ans))
    for dx in d:
        if dx in a:
            flag = True
    if flag:
        ans +=1
    else:
        print(ans)
        exit()
from collections import deque


def dfs(v, c):
    flgs[v] = c
    for i in range(len(G[v])):
        if flgs[G[v][i]] == c:
            return False
        if flgs[G[v][i]] == 0 and not dfs(G[v][i], -c):
            return False

    return True


if __name__ == '__main__':
    N, M = map(int, input().split())
    G = [[] for _ in range(N + 1)]
    for i in range(M):
        a, b = map(int, input().split())
        G[a].append(b)
        G[b].append(a)

    # 二部グラフ判定をする
    bi_flg = True
    flgs = [0 for _ in range(N + 1)]
    for i in range(1, N + 1):
        if flgs[i] == 0:
            if not dfs(i, 1):
                bi_flg = False

    if bi_flg:
        # 二部グラフならBW-M
        print(flgs.count(1) * flgs.count(-1) - M)
    else:
        # 二部グラフでないなら全辺-M
        print((N * (N - 1) // 2) - M)



### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)


def dfs(v, c):
    flgs[v] = c
    for i in range(len(G[v])):
        if flgs[G[v][i]] == c:
            return False
        if flgs[G[v][i]] == 0 and not dfs(G[v][i], -c):
            return False

    return True


if __name__ == '__main__':
    N, M = map(int, input().split())
    G = [[] for _ in range(N + 1)]
    for i in range(M):
        a, b = map(int, input().split())
        G[a].append(b)
        G[b].append(a)

    # 二部グラフ判定をする
    bi_flg = True
    flgs = [0 for _ in range(N + 1)]
    for i in range(1, N + 1):
        if flgs[i] == 0:
            if not dfs(i, 1):
                bi_flg = False

    if bi_flg:
        # 二部グラフならBW-M
        print(flgs.count(1) * flgs.count(-1) - M)
    else:
        # 二部グラフでないなら全辺-M
        print((N * (N - 1) // 2) - M)
n = int(input())
c = list(map(int, input().split()))

mod = 10**9 + 7
c.sort()
ans = 0

for i in range(n):
    ans += c[i] * pow(2, i, mod) % mod * (pow(2, n-i-2, mod) * (n-i-1) + pow(2, n-i-1, mod)) % mod * pow(2, n, mod) % mod
    ans %= mod

print(ans)


### FIXED CODE ###

n = int(input())
c = list(map(int, input().split()))

mod = 10**9 + 7
c.sort()
ans = 0

for i in range(n):
    ans += c[i] * pow(2, i, mod) % mod * (pow(2, n-i-2+n, mod) * (n-i-1) + pow(2, n-i-1+n, mod)) % mod
    ans %= mod

print(ans)
str1=input()
str2=input()
str3=input()

slice1=str1[-1:]
slice2=str2[:1]
slice3=str2[-1:]
slice4=str3[:1]

if slice1==slice2 and slice3==slice4:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

str1,str2,str3=input().split()
if str1[-1:]==str2[:1] and str2[-1:]==str3[:1]:
    print("YES")
else:
    print("NO")
# -*- coding: utf-8 -*-
from numba import njit, void, i8


def get_input() -> int:
    """
    標準入力を取得する.

    Returns:\n
        int: 標準入力
    """
    N = int(input())

    return N


@njit(void(i8))
def main(N: int) -> None:
    """
    求解処理.

    Args:\n
        N (int): 整数
    """
    # 求解処理
    ans = ""
    while N > 0:
        N -= 1
        ans += chr(ord("a") + N % 26)
        N //= 26
    ans = ans[::-1]

    # 結果出力
    print(ans)


if __name__ == "__main__":
    N = get_input()
    main(N)


### FIXED CODE ###

# -*- coding: utf-8 -*-
# 標準入力の取得
N = int(input())


def num_to_alpha(num):
    if num <= 26:
        return chr(96 + num)
    elif num % 26 == 0:
        return num_to_alpha(num // 26 - 1)+chr(122)
    else:
        return num_to_alpha(num // 26) + chr(96 + num % 26)


# 求解処理
ans = num_to_alpha(N)

# 結果出力
print(ans)
p=[]
for i in range(q):
    tmp = list(map(int,input().split()))
    p.append(tmp)

link = [[] for _ in range(n)]

for tmp in a:
    link[tmp[0]-1].append(tmp[1]-1)

from collections import defaultdict
d = defaultdict(int)

for tmp in p:
    d[tmp[0]-1]+=tmp[1]

from collections import deque
ans =[0]*n

Q = deque()
Q.append([0,0])

while Q:
    node= Q.popleft()

    val = node[1] + d[node[0]]
    ans[node[0]]+=val

    for nxt in link[node[0]]:
        Q.append([nxt,val])

print(*ans)

### FIXED CODE ###

import sys
input=sys.stdin.readline

n,q = map(int, input().split())
link = [[] for _ in range(n)]
for i in range(n-1):
    tmp = list(map(int,input().split()))
    link[tmp[0]-1].append(tmp[1]-1)
    link[tmp[1]-1].append(tmp[0]-1)

from collections import defaultdict
d = defaultdict(int)
for i in range(q):
    tmp = list(map(int,input().split()))
    d[tmp[0]-1]+=tmp[1]

from collections import deque
ans =[0]*n
finish  = {0}
Q = deque()
Q.append([0,0])
while Q:
    node= Q.popleft()
    finish.add(node[0])

    val = node[1] + d[node[0]]
    ans[node[0]]+=val

    for nxt in link[node[0]]:
        if nxt in finish:
            pass
        else:
            Q.append([nxt,val])

print(*ans)