Harryxun/stf_run huggingface dataset:
def main():
    N = int(input())
    A_list = list(map(int, input().split()))
    mod = 10**9 + 7

    ans = 0
    A_ = sum(A_list) % mod
    for i in range(N):
        A = A_list[i]
        A_ = A_ - A
        ans = (ans + (A * A_) % mod)) % mod
    print(ans)
    return


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N = int(input())
    A_list = list(map(int, input().split()))
    mod = 10**9 + 7

    ans = 0
    A_ = sum(A_list) % mod
    for i in range(N-1):
        A = A_list[i]
        A_ = A_ - A
        ans = (ans + (A * A_) % mod) % mod
    print(ans)
    return


if __name__ == '__main__':
    main()
a = list(input())
if a[2]==a[3] & a[4]==a[5]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a = list(input())
if a[2]==a[3] and a[4]==a[5]:
    print("Yes")
else:
    print("No")
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, m = map(int, input().split())
ans = []
if m % 2 == 0:
    right_range = n//2
    left_range = n//2 - 1
else:
    left_range = n//2
    right_range = n//2 - 1
left1 = 1
right1 = 1 + left_range
left2 = right1 + 1
right2 = left2 + right_range

for i in range(left_range):
    left1 += i
    right1 -= i
    if left1 >= right1:
        break
    ans.append([left1, right1])

for i in range(right_range):
    left2 += i
    right2 -= i
    if left2 >= right2:
        break
    ans.append([left2, right2])
    
for i in range(m):
    print(*ans[i])    




### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, m = map(int, input().split())
if n % 2 == 0:
    n -= 1
ans = []
left_range = n//2
right_range = n//2 - 1
left1 = 1
right1 = 1 + left_range
left2 = right1 + 1
right2 = left2 + right_range

while True:
    if left1 >= right1:
        break
    ans.append([left1, right1])
    left1 += 1
    right1 -= 1

while True:
    if left2 >= right2:
        break
    ans.append([left2, right2])
    left2 += 1
    right2 -= 1
    
for i in range(m):
    print(*ans[i])
r,c = map(int,input().split())

A = [list(map(int,input().split())) for i in range(c)]
for i in range(c):
    for j in range(r):
        print(A[i][j],end=" ")
    print(sum(A[i]))
for i in range(c):
    ans = 0
    for j in range(r):
        ans += A[j][i]
    print(ans,end=" ")
print(sum(map(sum,A)))



### FIXED CODE ###

r,c = map(int,input().split())

A = [list(map(int,input().split())) for i in range(r)]
for i in range(r):
    for j in range(c):
        print(A[i][j],end=" ")
    print(sum(A[i]))
for i in range(c):
    ans = 0
    for j in range(r):
        ans += A[j][i]
    print(ans,end=" ")
print(sum(map(sum,A)))
n = int(input())
for i in range(n+1):
  num += i
print(num)

### FIXED CODE ###

N = int(input())
cnt = 0
for i in range(N+1):
    cnt += i
print(cnt)
from collections import Counter

n = int(input())
t = [input() for i in range(n)]
c_list = []
ans = 0

for i in range(n):
  c = Counter(input())
  ans += c_list.count(c)
  c_list.append(c)
  
print(ans)
    

### FIXED CODE ###

from collections import Counter

n = int(input())
ans = 0
ctr = Counter()

for i in range(n):
  s = ''.join(sorted(list(input())))
  if s in ctr:
    ans += ctr[s]
  ctr[s] += 1
  
print(ans)
N=int(input())
root=[-1]*N
color=[-1]*N
from collections import defaultdict
tree=dict()
for i in range(N):
    tree[i]={i}
def search(i,cnt):
    if root[i]>=0:
        cnt+=1
        root[i]=search(root[i])
        return root[i],cnt
    return i,cnt
def makecolor(u,v):
    if color[u]==color[v]==-1:
        color[u]=0
        color[v]=1
    elif color[u]=-1:
        color[v]=(color[u]+1)%2
    elif color[v]=-1:
        color[u]=(color[v]+1)%2
    else:
        if color[u]==color[v]:
            for x in tree[v]:
                color[x]=(color[x]+1)%2
for i in range(N-1):
    u,v,w=map(int,input().split())
    if w%2==0:
        continue
    u-=1
    v-=1
    branch[u]|={v}
    branch[v]|={u}
    ru=search(u)
    rv=search(v)
    if ru==rv:
        continue
    
    if root[ru]<=root[rv]:
        root[rv]+=root[ru]
        root[ru]=rv
        makecolor(rv,ru)
        tree[rv]|=tree[ru]
    else:
        root[ru]+=root[rv]
        root[rv]=ru
        makecolor(ru,rv)
        tree[ru]|=tree[rv]
color=[i if i!=-1 else 1 for i in color]
for i in range(N):
    print(color[i])

### FIXED CODE ###

N=int(input())
from collections import defaultdict
branch=defaultdict(dict)
for i in range(N-1):
    u,v,w=map(int,input().split())
    branch[u-1][v-1]=w
    branch[v-1][u-1]=w
dist=[float('inf')]*N
dist[0]=0
check={0}
while len(check)>0:
    now=check.pop()
    for nex,w in branch[now].items():
        if dist[nex]>dist[now]+w:
            dist[nex]=dist[now]+w
            check|={nex}
color=[d%2 for d in dist]
for i in range(N):
    print(color[i])
K, N = map(int,input().split())
A = list(map(int, input().split()))
a = A[0]
sub = []
for _ in range(N):
    p = A.pop()
    sub.append(K-p)
    K = p
sub[0] += a
sub.remove(max(sub))
print(sum(sub))

### FIXED CODE ###

S = input()
ans = 'No'
if S[2] == S[3] and S[4] == S[5]:
   ans = 'Yes'
print(ans)
a = int(input())
b = int(input())
c = int(input())
for i in range(c):
    if(a!=0):
        a-1
    b-1


### FIXED CODE ###

cookies = [int(x) for x in input().split()]
leftOver = cookies[0] - cookies[2]
takahashi = max(0, leftOver)
print(str(takahashi)+ ' ' + (str(cookies[1]) if takahashi > 0  else str(max(0,cookies[1] - abs(leftOver)))))
N, T = input().split()

f = None
p = None
ans = 0
for t in map(int, input().split())
  if f is None:
    f = t
    p = t - f

  ans += T
  rest = p + T - (t - f)
  if rest > 0:
    ans -= rest

  p = t - f

print(ans)

### FIXED CODE ###

N, T = map(int, input().split())

f = None
p = None
ans = 0
for t in map(int, input().split()):
  if f is None:
    f = t
    p = f - T

  ans += T
  rest = p + T - (t - f)
  if rest > 0:
    ans -= rest
  p = t - f

print(ans)
from functools import reduce
from fractions import gcd

N = int(input())
A = list(map(int,input().split()))

def gcd_list(numbers):
    return reduce(gcd, numbers)

ans = 1
for i in range(len(A)):
    l = A.copy()
    l.pop(i)
    ans = max(ans,gcd(*l))

print(ans)



### FIXED CODE ###

from fractions import gcd
import math
N = int(input())
A = list(map(int, input().split()))

gl = [0] * (N-1)
gr = [0] * (N-1)

gl[0] = A[0]
gr[0] = A[-1]
for i in range(1,N-1):
    gl[i] = gcd(gl[i-1],A[i])
    gr[i] = gcd(gr[i-1],A[-i-1])
#print(gl[i])
ans = max(gr[-1],gl[N-2])
for i in range(1,N-1):
    g = gcd(gl[i-1],gr[-i-1])
    ans = max(ans,g)
#print(gl,gr)
print(ans)
a,b=map(int,input().split())
if a>9 b>9 
 print("-1")
else :
  print(a*b)

### FIXED CODE ###

a,b=map(int,input().split())
if a>=10 or b>=10:
  print(-1)
else:
  print(a*b)
from math import *

def main():
    N, M = map(int, input().split())
    special_value = M//N
    divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
    divisor_set = divisor_set.union(M//j for j in divisor_set)
    print(int(max(divisor_set, key=lambda x: x if special_value >= x else -1)))

    return

if __name__ == "__main__":
main()

### FIXED CODE ###

from math import *

def main():
    N, M = map(int, input().split())
    if N==1:
        print(M)
        return
    special_value = M//N
    divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
    divisor_set = divisor_set.union(M/j for j in divisor_set)
    print(int(max([i for i in divisor_set if special_value >= i])))
    return

main()
N = int(input())

#文字数分aで埋める
#末尾をbにする
#一桁上の文字+1文字までは許容するルールで増加させていく

ans = [0 for _ in range(N)]
stop = [i for i in range(N)]

def ans_print(ans_list):
    ans = list()
    for a in ans_list:
        ans.append(chr(a+97)) #97でaが出る

    print(''.join(map(str, ans)))
    return 0

while 1:
    ans_print(ans)
    
    ans[-1] += 1

    for i in range(N-1,0,-1):
        if ans[i] > ans[i-1]+1:
            ans[i-1] += 1
            ans[i] = 0
            
    if ans == stop:
        ans_print(ans)
        break


### FIXED CODE ###

N = int(input())

#文字数分aで埋める
#末尾をbにする
#一桁上の文字+1文字までは許容するルールで増加させていく

ans = [0 for _ in range(N)]
stop = [i for i in range(N)]

def ans_print(ans_list):
    ans = list()
    for a in ans_list:
        ans.append(chr(a+97)) #97でaが出る

    print(''.join(map(str, ans)))
    return 0

def ans_check(ans):
    max_in_ans = 0

    for i in range(1,N):
        if max_in_ans + 1 < ans[i]:
            ans[i-1] += 1
            ans[i] = 0
            return ans_check(ans)
        else:
            max_in_ans = max(max_in_ans,ans[i])
    else:
        return ans

if N == 1:
    print("a")
else:
    while 1:
        ans_check(ans)
        ans_print(ans)
        ans[-1] += 1
        if ans == stop:
            ans_print(ans)
            break
S = input()

h = S/3600
m = S%3600/60
s = S%3600%60

print h:m:s

### FIXED CODE ###

S = input()
  
h = S/3600
m = (S%3600)/60
s = (S%3600)%60
  
print '%d:%d:%d' % (h,m,s)
k = int(input())
a, b = map(int, input().split())
for i in range(a, b+1):
  if(i%k == 0):
    print("OK")
    exsi()
print("NG")

### FIXED CODE ###

k = int(input())
a, b = map(int, input().split())
for i in range(a, b+1):
  if(i%k == 0):
    print("OK")
    exit()
print("NG")
n, x = map(int, input().split())
a = []
for i in range(n):
  k = input().split()[i]
  a.append(int(k))
counter = 0
for i in a.sort():
  x -= i
  if x <0:
    print(counter)
  else:
    counter += 1

### FIXED CODE ###

n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in sorted(a):
  x -= i
  counter += 1
  if x<0:
    print(counter-1)
    break
  elif x==0:
    print(counter)
    break
  else:
    if counter==n:
      print(counter-1)
# -*- coding: utf-8 -*-
N = int(input())
A = [int(v) for v in input().split(' ')]

# 負の数が偶数 -> 全部+にできる
# 負の数が奇数 -> どれか一つが-になる
# 負の数の偶奇チェック
sign = 1
for a in A:
    sign *= a/abs(a)

abs_A = [abs(a) for a in A]

if sign > 0:
    print(sum(abs_A))
else:
    print(sum(abs_A)-min(abs_A)*2)

### FIXED CODE ###


N = int(input())
A = [ int(v) for v in input().split() ]

if N < 2 and 1e5 < N: raise()
for v in A:
    if v < -1e9 and v < 1e9: raise()

abs_list = [abs(v) for v in A]

total = sum( abs_list )
num_of_minus = sum([ True for v in A if v < 0 ])

if num_of_minus % 2 == 1:
    print(total - min( abs_list ) * 2)
else:
    print(total)
from copy import copy
n = int(input())
a = list(map(int, input().split()))

ok, ng = n, 0
while ok-ng > 1:
	x = (ok+ng)//2
	#d = defaultdict(int)
	d = dict()
	last = 0
	valid = True
	if x == 1:
		for i in range(n-1):
			if a[i] >= a[i+1]:
				valid = False
				break
		if valid:
			ok = x
		else:
			ng = x
		continue

	for i in range(n-1):
		dels = []
		if a[i] < a[i+1]:
			last = a[i+1]
		elif a[i] > a[i+1]:
			#dels = []
			for k in d.keys():
				if k > last:
					dels.append(k)
			if a[i+1] > last:
				d[a[i+1]] = 1
			else:
				j = a[i+1]
				while j in d:
					if d[j] != x-1 or j <= 0:
						break
					else:
						dels,append(j)
						j -= 1
				if j in d:
					d[j] += 1
				else:
					d[j] = 1
			last = a[i+1]
		elif a[i] == a[i+1]:
			#dels = []
			for k in d.keys():
				if k > last:
					dels.append(k)
			j = a[i+1]
			while j in d:
				if d[j] != x-1 or j <= 0:
					break
				else:
					dels.append(j)
					j -= 1
			if j in d:
				d[j] += 1
			else:
				d[j] = 1
			last = a[i+1]

		for k in dels:
			del d[k]

		if 0 in d:
			valid = False
			break

	if valid:
		ok = x
	else:
		ng = x
print(ok)

### FIXED CODE ###

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

ok, ng = n, 0
while ok-ng > 1:
	x = (ok+ng)//2
	#d = defaultdict(int)
	d = dict()
	last = 0
	valid = True
	if x == 1:
		for i in range(n-1):
			if a[i] >= a[i+1]:
				valid = False
				break
		if valid:
			ok = x
		else:
			ng = x
		continue

	for i in range(n-1):
		dels = []
		if a[i] < a[i+1]:
			last = a[i+1]
			continue

		j = a[i+1]
		for k in d.keys():
			if j < k:
				dels.append(k)

		while j > 0:
			if j in d and d[j] == x-1:
				#d[j] = 0
				dels.append(j)
				j -= 1
			else:
				break

		if j in d:
			d[j] += 1
		else:
			d[j] = 1

		for k in dels:
			del d[k]

		if 0 in d:
			valid = False
			break
		last = j

	if valid:
		ok = x
	else:
		ng = x
print(ok)
now_Rating = int(input(R))
average = int(input(G))

x = 2*average-now_Rating

prtint(x)



### FIXED CODE ###

R = int(input())
G = int(input())

x = 2*G-R
print (x)
s=input()
t=input()
 
for i in range(s.size()):
  if s[i]!=t[i]:
    ans += 1
print(ans)

### FIXED CODE ###

s=input()
t=input()
ans=0
for i in range(len(s)):
  if s[i]!=t[i]:
    ans += 1
print(ans)
n = int(input())
if n % 2 == 1:
    print((int(n - 1) / 2))
else:
    printint((n / 2 - 1))
    

### FIXED CODE ###

n = int(input())
if n % 2 == 1:
    print(int((n - 1) / 2))
else:
    print(int(n / 2 - 1))
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

  
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
  
  
N,M = map(int, input().split())
m_factorized = factorize(M)
mod = 10 ** 9 + 7
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
ans = 1
for i in range( 2, 2**N + 1 ):
  g1.append( ( g1[-1] * i ) % mod )
  inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
  g2.append( (g2[-1] * inverse[-1]) % mod )
    
    
for i in m_factorized:
  k = i[1] 
  ans *= cmb(N-1+k,k,mod)
  ans %= mod
print(ans)
  

### FIXED CODE ###

n = list(map(int,input().split()))
n.sort()
n.reverse()
print(n[0]*10+n[1]+n[2])
def inpl(): return [int(i) for i in input().split()]
import heapq
from itertools import permutations

N, M, R = inpl()
r = inpl()
inf = 10**11
Q = [[inf] * N for _ in range(N)]
path = [[0] * N for _ in range(N)]

for i in range(M):
    A,B,C = inpl()
    path[A-1][B-1] = path[B-1][A-1] = C

for i in r:
    decided = [False for _ in range(N)]
    H = []
    ctr = 0
    Q[i][i] = 0
    heapq.heappush(H,(0,i))
    for _ in range(N):
        while True:
            k = heapq.heappop(H)
            k = k[1]
            if not decided[k]:
                decided[k] = True
                break
        for j in range(N):
            if path[k][j] == 0:
                continue
            if decided[j]:
                continue
            Q[i][j] = min(Q[i][k] + path[k][j], Q[i][j])
            heapq.heappush(H,(Q[i][j],j))

Ans = inf
for i in permutations(r):
    ans = 0
    for j in range(R-1):
        ans += Q[i[j]-1][i[j+1]-1]
    Ans = min(Ans,ans) 
        
print(Ans)

### FIXED CODE ###

def inpl(): return [int(i) for i in input().split()]
import heapq
from itertools import permutations

N, M, R = inpl()
r = inpl()
for i in range(R):
    r[i] -= 1
inf = float('inf')
Q = [[inf] * N for _ in range(N)]
path = [[0] * N for _ in range(N)]

for i in range(M):
    A,B,C = inpl()
    path[A-1][B-1] = path[B-1][A-1] = C

for i in r:
    decided = [False for _ in range(N)]
    H = []
    ctr = 0
    Q[i][i] = 0
    heapq.heappush(H,(0,i))
    while ctr != N:
        while True:
            k = heapq.heappop(H)
            k = k[1]
            if not decided[k]:
                decided[k] = True
                ctr += 1
                break
        for j in range(N):
            if path[k][j] == 0:
                continue
            if decided[j]:
                continue
            Q[i][j] = min(Q[i][k] + path[k][j], Q[i][j])
            heapq.heappush(H,(Q[i][j],j))

Ans = inf
for i in permutations(r):
    ans = 0
    for j in range(R-1):
        ans += Q[i[j]][i[j+1]]
    Ans = min(Ans,ans) 
        
print(Ans)
N = int(input())

s = map(int,input().split())

s.sort()

sum = 0

for i in range(N):
  sum = sum + s[2*i+1]

print(sum)

### FIXED CODE ###

N = int(input())

s = list(map(int,input().split()))

s.sort()

sum = 0

for i in range(N):
  sum = sum + s[2*i]

print(sum)
import sys
import fractions
import functools
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
a = LIST()

res = 0
for i in range(n):
    aa = a[:i] + a[i+1:]
    gcd = reduce(math.gcd, aa)
    res = max(res,gcd)

print(res)


### FIXED CODE ###

import sys
import fractions
import functools
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
a = LIST()

L = [0]*n
R = [0]*n
L[0] = INF
L[1] = a[0] 
R[n-1] = INF
R[n-2] = a[n-1]

GCDs = [0]*n

for i in range(2, n):
    L[i] = fractions.gcd(L[i-1], a[i-1])

for i in range(n-3,-1,-1):
    R[i] = fractions.gcd(R[i+1], a[i+1])

GCDs[0] = R[0]
GCDs[n-1] = L[n-1]

for i in range(1,n-1):
    GCDs[i] = fractions.gcd(L[i], R[i])

res = max(GCDs)

print(res)
import math

class Input():
	def readInt(self):
		return int(input())

	def readIntArray(self):
		return [int(x) for x in input().split(" ")]

	def readString(self):
		return input()

	def readStringArray(self):
		return input().split(" ")

	def readFloat(self):
		return float(input())

	def readFloatArray(self):
		return [float(x) for x in input().split(" ")]

def main():
	inp = Input()
	n, k = inp.readIntArray()
	height = inp.readIntArray()

	cost = [math.inf for i in range(n)]
	cost[0] = 0

	for i in range(n):
		for j in range(1, k+1):
			if (i + j) < n:
				cost[i+j] = min(cost[i+j], cost[i] + abs(height[i+j] - height[i]))

	print(cost[n-1])
	

if __name__ == "__main__":
   main()


### FIXED CODE ###

n, k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]

def abs(x):
    if x >= 0:
        return x
    return -x

c = [0]
c.append(abs(h[1] - h[0]))
for i in range(2, n):
    cmin = None
    for cur in range(i-1, i-1-k, -1):
        if cur < 0:
            break
        val = abs(h[i] - h[cur]) + c[cur]
        if cmin is None or val < cmin:
            cmin = val
    c.append(cmin)

print(c[-1])
S=sorted(set(input()))
ans=None
for i in range(97,97+26):
  if chr(i)!=S[i-97]:
    ans=chr(i)
    break
print(ans)


### FIXED CODE ###

import sys
s = sorted(input())
a = ord('a')
for j in range(26):
    b = a
    for i in s:
        if a == ord(i):
            a += 1
            break
    if a == b:
        print(chr(a))
        sys.exit()
print('None')
N = int(input())
H = list(map(int, input().split()))
for i in range(N-1,0,-1):
    if H[i]>H[i-1]:
        if H[i]>(H[i]-1):
            print("No")
            exit()
print("Yes")


### FIXED CODE ###

A, B, C = map(int, input().split())
print(C-A+B if C-A+B>0 else 0)
moutain = [0 for i in range(10)]
for i in range(10):
    moutain[i] = int(raw_input())
moutain.sort().reverse()
for i in range(3):
    moutain[i]


### FIXED CODE ###

moutain = [0 for i in range(10)]
for i in range(10):
    moutain[i] = int(raw_input())
moutain.sort(reverse=True)
for i in range(3):
    print moutain[i]
n = int(input())
edge = [tuple(map(int, input().split())) for _ in range(n-1)]
connect = [set() for _ in range(n)]
for a, b in edge:
    connect[a-1].add(b-1)
    connect[b-1].add(a-1)

d1 = [0] * n
dn = [0] * n

def dfs(v, ng, dis, d):
    d[v] = dis
    ng.add(v)
    for n in connect[v]:
        if n not in ng:
            dfs(n, ng, dis+1, d)

dfs(0, set(), 0, d1)
dfs(n-1, set(), 0, dn)

black = 0
white = 0
for i in range(n):
    if d1[i] < dn[i]:
        black += 1
    else:
        white += 1
if black > white:
    print('Fennec')
else:
    print('Snuke')

### FIXED CODE ###

import sys
sys.setrecursionlimit(2 * 10 ** 5)

n = int(input())
edge = [tuple(map(int, input().split())) for _ in range(n-1)]
connect = [set() for _ in range(n)]
for a, b in edge:
    connect[a-1].add(b-1)
    connect[b-1].add(a-1)

d1 = [0] * n
dn = [0] * n

def dfs(v, ng, dis, d):
    d[v] = dis
    ng.add(v)
    for n in connect[v]:
        if n not in ng:
            dfs(n, ng, dis+1, d)

dfs(0, set(), 0, d1)
dfs(n-1, set(), 0, dn)

black = 0
white = 0
for i in range(n):
    if d1[i] <= dn[i]:
        black += 1
    else:
        white += 1
if black > white:
    print('Fennec')
else:
    print('Snuke')
a = list(map(int, input().split()))
a.sort(reversed = True)
print(a[0]*10+a[1]+a[2])


### FIXED CODE ###

a = list(map(int, input().split()))
a.sort(reverse = True)
print(int(a[0])*10+a[1]+a[2])
# coding:utf-8

import sys
from collections import deque, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n, m = LI()

    G = defaultdict(list)
    deg = [0] * n
    for _ in range(m):
        a, b = LI_()
        G[a].append(b)
        G[b].append(a)
        deg[a] += 1
        deg[b] += 1

    ss = []
    for i in range(n):
        if deg[i] == 1:
            s = i
            ss = []
            break
        if deg[i] % 2 == 0:
            ss.append(i)

    if not ss:
        print(2)
        print(*[s + 1, G[s][0] + 1])
        exit()

    def DFS(v: int, res: list, visited: set, needs: set) -> None:
        res.append(v + 1)
        visited.add(v)
        needs -= set([v])
        if not needs:
            print(len(res))
            print(*res)
            exit()

        for to in G[v]:
            if to in visited:
                continue
            DFS(to, res, visited, needs)

    for s in ss:
        DFS(G[s][0], [s+1], set([s]), set(G[s][1:]))


main()


### FIXED CODE ###

# coding:utf-8

import sys
from collections import deque, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n, m = LI()

    G = defaultdict(list)
    S = defaultdict(set)
    for _ in range(m):
        a, b = LI_()
        G[a].append(b)
        G[b].append(a)
        S[a].add(b)
        S[b].add(a)

    res = deque([0, G[0][0]])
    visited = set(res)
    needs = S[res[0]] | S[res[-1]] - visited
    while needs:
        v = needs.pop()
        if v in visited:
            continue
        visited.add(v)
        if v in S[res[0]]:
            res.appendleft(v)
        else:
            res.append(v)
        needs = (S[res[0]] | S[res[-1]]) - visited

    print(len(res))
    print(*[v + 1 for v in res])


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

ans = 0
res = M
for v in X:
    ans += v[0] * min(v[1], res)
    res -= v[1]
    if res <= 0:
        break
        
print(res)

### FIXED CODE ###

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

ans = 0
res = M
for v in X:
    ans += v[0] * min(v[1], res)
    res -= v[1]
    if res <= 0:
        break
        
print(ans)
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
while M>0:
    d = A[0]//A[1]
    A[0] = A[0]//2**d
    M -= d
    A = sorted(A, reverse=True)
    # print(A, M)

print(sum(A))

### FIXED CODE ###

import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [-a for a in A]
A = sorted(A)
heapq.heapify(A)
for _ in range(M):
    ma = heapq.heappop(A)
    ma = -((-ma)//2)
    heapq.heappush(A, ma)
    # print(A, ma)
print(-sum(A))