Harryxun/stf_run huggingface dataset:
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x=="r":
    c+=P
  elif x=="s":
    c+=R
  else:
    c+=S
  return c
for i in range(len(T)):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
    if T[i-K]!="o" and T[i-K]==T[i]:
      T[i]="o"
print(c)

### FIXED CODE ###

N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x=="r":
    c+=P
  elif x=="s":
    c+=R
  else:
    c+=S
  return c
n=len(T)
for i in range(n):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
    if T[i-K]!="o" and T[i-K]==T[i]:
      T=T[:i]+"o"+T[i+1:]
print(c)
import sys


list_line = sys.stdin.readlines()

for index, element in enumerate(list_line):
    list_line[index] = element.rstrip('\n')

for element in list_line:
    if int(element[0]) == 0 and int(element[2]) == 0:
        sys.exit()
    if(int(element[0]) > int(element[2])):
        print(element[2] + " " + element[0])
    else:
        print(element)

### FIXED CODE ###

import sys


list_line = sys.stdin.readlines()

for index, element in enumerate(list_line):
    list_line[index] = element.rstrip('\n')

for element in list_line:
    x_y_list = element.split(" ")
    x = int(x_y_list[0])
    y = int(x_y_list[1])
    if x == 0 and y == 0:
        sys.exit()
    if x > y:
        print(str(y) + " " + str(x))
    else:
        print(element)
import sys
while 1:
    try:
        temp = input()
        if (temp==0):
            break
            N = temp
            a = []
            for i in range(N):
                a.append(map(int, raw_input().split())+[0])
            a.append([0 for i in range(0,temp+1)])	 
            for i in range(0,temp):#行に関して
                for j in range(0,temp):#列に関して
                    a[i][temp] += a[i][j]
            for k in range(0,temp+1):#列に関して
                for l in range(0,temp):#行に関して
                    a[temp][k] += a[l][k]
            for m in range(0,temp+1):
                for n in range(0,temp+1):
                    sys.stdout.write(str(a[m][n]).rjust(5))
                print ""
    except(RuntimeError):
        pass

### FIXED CODE ###

import sys
try:
	while 1:
		temp = input()
		if (temp==0):
			break
		N = temp
		a = []
		for i in range(N):
			a.append(map(int, raw_input().split())+[0])
		a.append([0 for i in range(0,temp+1)])
		for i in range(0,temp):
			for j in range(0,temp):
				a[i][temp] += a[i][j]
		for k in range(0,temp+1):
			for l in range(0,temp):
				a[temp][k] += a[l][k]
		for m in range(0,temp+1):
			for n in range(0,temp+1):
				sys.stdout.write(str(a[m][n]).rjust(5))
			print ""
except(RuntimeError):
	pass
t = "Yay!"
f = ":("

antennas = [input() for _ in range(5)]
k = input()

if max(antennas) <= k:
  print(t)
else:
  flag = True
  for i in antennas:
    for j in antennas:
      if abs(i-j) >= k:
        flag = False
  if flag: print(t)
  else: print(f)
    

### FIXED CODE ###

t = "Yay!"
f = ":("

antennas = [int(input()) for _ in range(5)]
k = int(input())

if max(antennas) <= k:
    print(t)
else:
    flag = True
    for i in antennas:
        for j in antennas:
            if abs(i - j) >= k:
                flag = False
    if flag:
        print(t)
    else:
        print(f)
in = input().split()
A = int(in[0])
B = int(in[1])

if A < B:
  v = B
  B = A
  A = v

R = A % B
while R !=0:
  R = A % B
  A = B
  B = R
return A


### FIXED CODE ###

s = input().split()
A = int(s[0])
B = int(s[1])

if A < B:
  v = B
  B = A
  A = v

R = A % B
while R !=0:
  A = B
  B = R
  R = A % B
print(B)
import numpy as np
a,b = map(float,input().split())
 
c = np.array([a],dtype='f16')
d = np.array([b],dtype='f16')
e = np.array([],dtype='f16')
e = c*d
print(int(e))

### FIXED CODE ###

a,b = map(str,input().split())
from decimal import Decimal
print(int(Decimal(a)*Decimal(b)))
W, H, x, y = map(int, input().split())

if W / x == 2 and H / y == 2:
    print(W * H / 2, 1)
elif W == H:
    print(W * H / 2, 0)
elif W / x == 2 or H / y == 2:
    print(W * H / 2, 0 )
else:
    h = max(x, W - x)
    w = max(y, H - y)
    print(H/h * W/w /2)
    

### FIXED CODE ###

W, H, x, y = map(int, input().split())

"""
直方体は中身を通る線で半分に割ることができる
"""

if W/2 == x and H/2 == y:
    print(W * H / 2, 1)
else:
    print(W * H / 2, 0)
K = input("")
A, B = map(int, input().split())
number = False
for i in range(A, B+1):
    if number % K == 0:
        number = True
        
print("OK" if number else "NG")

### FIXED CODE ###

K = int(input(""))
A, B = map(int, input().split())
number = False
for i in range(A, B+1):
    if i % K == 0:
        number = True

print("OK" if number else "NG")
import sys
from collections import defaultdict


def dfs(tree, p, cnt):
    for c in tree[p]:
        cnt[c] += cnt[p]
        dfs(tree, c, cnt)


def main():
    input = sys.stdin.buffer.readline
    n, q = map(int, input().split())
    tree = defaultdict(list)
    for _ in range(n - 1):
        a, b = map(int, input().split())
        tree[a].append(b)

    cnt = [0] * (n + 1)
    for i in range(q):
        p, x = map(int, input().split())
        cnt[p] += x

    dfs(tree, 1, cnt)
    print(*cnt[1:])


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from collections import defaultdict


def dfs(tree, p, cnt, visited):
    visited[p] = True
    cnt_here = cnt[p]
    for c in tree.get(p):
        if visited[c]:
            continue
        cnt[c] += cnt_here
        dfs(tree, c, cnt, visited)


def main():
    input = sys.stdin.buffer.readline
    sys.setrecursionlimit(10 ** 9)
    n, q = map(int, input().split())
    tree = defaultdict(list)
    for _ in range(n - 1):
        a, b = map(int, input().split())
        tree[a].append(b)
        tree[b].append(a)
    tree = dict(tree)
    cnt = [0] * (n + 1)

    for _ in range(q):
        p, x = map(int, input().split())
        cnt[p] += x
    visited = [False] * (n + 1)
    dfs(tree, 1, cnt, visited)
    print(*cnt[1:])


if __name__ == "__main__":
    main()
# 最大公約数を格納するリストを初期化
max_codiv = []
 
# 繰り返す数を入力
n = int(input())
 
import math
# 1からkまでの総当たりで最大公約数を調べる
for i in range(1, n+1):
    for j in range(1, n+1):
    	i_j = math.gcd(i, j)
        for k in range(1, n+1):
            i_j_k = math.gcd(i_j, k)
            max_codiv.append(i_j_k)
print(sum(max_codiv))

### FIXED CODE ###

# 最大公約数を格納するリストを初期化
max_codiv = []
 
# 繰り返す数を入力
n = int(input())
 
import math
# 1からkまでの総当たりで最大公約数を調べる
for i in range(1, n+1):
	for j in range(1, n+1):
		i_j = math.gcd(i, j)
		for k in range(1, n+1):
			i_j_k = math.gcd(i_j, k)
			max_codiv.append(i_j_k)
print(sum(max_codiv))
a = list(map(int.input().split()))
print(max(0,a[2]-(a[0]-a[1])))

### FIXED CODE ###

a = list(map(int,input().split()))
print(max(0,a[2]-(a[0]-a[1])))
import sys
from collections import deque
sys.setrecursionlimit(10**9)
N = int(input())
es = {(i,j):[] for i in range(N) for j in range(i+1,N)}
se = {(i,j):[] for i in range(N) for j in range(i+1,N)}
ins = {(i,j):0 for i in range(N) for j in range(i+1,N)}
dp = {(i,j):-1 for i in range(N) for j in range(i+1,N)}
def TP_sort(E, ins, start):
  q = deque(start)
  res = []
  while q:
    p = q.popleft()
    res += [p]
    for c in E[p]:
      ins[c] -= 1
      if ins[c]==0:
        q.append(c)
  if ins[res[-1]]!=0:
    return -1
  return res

def dfs(e):
  if dp[e]!=-1:
    return dp[e]
  m = 0
  for ex in se[e]:
    x = dfs(ex)
    if x>m:
      m = x
  dp[e] = m+1
  return m+1

for i in range(N):
  inf = [int(i)-1 for i in input().split()]
  for j in range(N-2):
    x = min(i, inf[j])
    y = max(i, inf[j])
    nx = min(i, inf[j+1])
    ny = max(i, inf[j+1])
    es[(x,y)] += [(nx,ny)]
    se[(nx,ny)] += [(x,y)]
    ins[(nx,ny)] += 1
start = [v1 for v1 in ins.keys() if ins[v1]==0]
ls = TP_sort(es, ins, start)
if ls==-1:
  print(-1)
else:
  for i in start:
    dp[i] = 0
  print(dfs(ls[-1])+1)


### FIXED CODE ###

N = int(input())
es = [[] for i in range(N)]
cand = set()
for i in range(N):
  es[i] = [int(i)-1 for i in input().split()][::-1]
def check(i):
  if es[i]==[]:
    return
  j = es[i][-1]
  if es[j]==[]:
    return
  if es[j][-1]==i:
    cand.add(i)
    cand.add(j)

for i in range(N):
  check(i)
day = 0
while cand:
  day += 1
  precand = cand.copy()
  cand = set()
  for i in precand:
    x = es[i].pop()
  for i in precand:
    check(i)
for i in range(N):
  if len(es[i])!=0:
    print(-1)
    break
else:
  print(day)
a, b = map(int, input().split())
c = []
d = []
for i in range(a):
    c.append(list(input()))
for i in range(b):
    d.append(list(input()))
for i in range(a-b+1):
    for j in range(a-b+1):
        m = n = 0
        o = True
        for k in range(i,i+b):
            n = 0
            for l in range(k, k+b):
                if c[k][l] != d[m][n]:
                    o = not o
                n += 1
            m += 1
        if o:
            print("Yes")
            exit()
print("No")


### FIXED CODE ###

a, b = map(int, input().split())
c = []
d = ""
for i in range(a):
    c.append(list(input()))
for i in range(b):
    d += input()
e = []
for i in range(a-b+1):
    for j in range(a-b+1):
        f = ""
        for k in range(b):
            for l in range(b):
                f += c[i+k][j+l]
        e.append(f)
print("Yes" if d in e else "No")
n,k = map(int,input().split())
A=list(map(int, input().split()))
now = 1
if n>=k:
    for i in k:
        now = A[now-1]
        exit()
past = []
while now not in past:
    past.append(now)
    now = A[now-1]
loop_size = len(past)-past.index(now)
surplus = (k-past.index(now))%loop_size
for i in range(surplus):
    now = A[now-1]
print(now)

### FIXED CODE ###

n,k = map(int, input().split())
b = list(map(int, input().split()))
a=0
for i in range(n):
    b[i] -= 1
if k<n:
    for i in range(k):
        a = b[a]
    print(a+1)
    exit()
c = [-1]*n
cc = 0
se = set()
while a not in se:
    c[a] = cc
    cc += 1
    se.add(a)
    a = b[a]
for i in range((k-c[a])%(cc-c[a])):
    a = b[a]
print(a+1)
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a=list(set(a))
b=list(set(b))
c=list(set(c))
a.sort()
b.sort()
c.sort()
i,j=0,0
d1=dict()
for k in a:
  if b[i]>k:
    j+=1
  else:
    d1[b[i]]=j
    i+=1
for t in range(i,len(b)):
  d1[b[t]]=j
i,j=0,0
d2=dict()
for k in b:
  if c[i]>k:
    j+=d1[k]
  else:
    d2[c[i]]=j
    i+=1
for t in range(i,len(c)):
  d2[c[t]]=j
print(sum(d2.values()))


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
i,j,k=0,0,0
m1=[]
while k<n and i<n:
  if b[i]>a[k]:
    j+=1
    k+=1
  else:
    m1.append(j)
    i+=1
for t in range(len(m1),len(b)):
  m1.append(j)
i,j,k=0,0,0
m2=[]
while k<n and i<n:
  if c[i]>b[k]:
    j+=m1[k]
    k+=1
  else:
    m2.append(j)
    i+=1
for t in range(len(m2),len(c)):
  m2.append(j)
print(sum(m2))
sys.setrecursionlimit(10000000)
def calc(dp,adj,i):
    if(len(adj[i])==0):
        dp[i]=0
    elif dp[i]<0:
        for j in adj[i]:
            dp[i]=max(dp[i],calc(dp,adj,j))
        dp[i]+=1
    return dp[i]
n,m=map(int,input().split())
adj=[]
for i in range(n+1):
    adj.append([])
for i in range (m):
    x,y=map(int,input().split())
    adj[x].append(y)
dp=[-1]*(n+1);
for i in range(1,n+1):
    calc(dp,adj,i)
print(max(dp))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)
def calc(dp,adj,i):
    if(len(adj[i])==0):
        dp[i]=0
    elif dp[i]>0:
        return dp[i]
    else:
        for j in adj[i]:
            dp[i]=max(dp[i],calc(dp,adj,j))
        dp[i]+=1
    return dp[i]
n,m=map(int,input().split())
adj=[]
for i in range(n+1):
    adj.append([])
for i in range (m):
    x,y=map(int,input().split())
    adj[x].append(y)
dp=[-1]*(n+1);
for i in range(1,n+1):
    calc(dp,adj,i)
print(max(dp))
import sys
sys.setrecursionlimit(100100)
from collections import deque
def factorials(M):#M!までのリストｘと其の逆元のリストyを返すmod INF
    INF=int(1e9+7)
    fac=[0]*(M+1)
    finv=[0]*(M+1)
    inv=[0]*(M+1)
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,M+1):
        fac[i]=(fac[i-1]*i)%INF
        inv[i]=INF-(inv[INF%i]*(INF//i))%INF
        finv[i]=finv[i-1]*inv[i]%INF
    return fac,finv

N,K=map(int,input().split())
fac,finv=factorials(K)
def nCr(n,r):
    INF=int(1e9+7)
    if n<r or r<0 or n<0 :
        return 0
    return fac[n]*(finv[r]*finv[n-r]%INF)%INF
A=[0]*N
G=[[] for i in range(N)]
MOD=10**9+7
for i in range(N-1):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    A[a]+=1
    A[b]+=1
    G[a].append(b)
    G[b].append(a)
ans=K
can=K
grand=0
gpare=-1
stack=deque([[0,gpare]])
while(stack):
    pare,gpare=stack.pop()
    childs=G[pare]
    ans*=nCr(K-1-grand,len(childs)-grand)*fac[len(childs)-grand]
    ans%=MOD
    grand=1
    for i in childs:
        if i==gpare:
            continue
        if A[i]-1==0:
            continue
        stack.append([i,pare])
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100100)
from collections import deque
def factorials(M):#M!までのリストｘと其の逆元のリストyを返すmod INF
    INF=int(1e9+7)
    fac=[0]*(M+1)
    finv=[0]*(M+1)
    inv=[0]*(M+1)
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,M+1):
        fac[i]=(fac[i-1]*i)%INF
        inv[i]=INF-(inv[INF%i]*(INF//i))%INF
        finv[i]=finv[i-1]*inv[i]%INF
    return fac,finv

N,K=map(int,input().split())
fac,finv=factorials(max(N,K))
def nCr(n,r):
    INF=int(1e9+7)
    if n<r or r<0 or n<0 :
        return 0
    return fac[n]*(finv[r]*finv[n-r]%INF)%INF
A=[0]*N
G=[[] for i in range(N)]
MOD=10**9+7
for i in range(N-1):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    A[a]+=1
    A[b]+=1
    G[a].append(b)
    G[b].append(a)
ans=K
can=K
grand=0
gpare=-1
stack=deque([[0,gpare]])
while(stack):
    pare,gpare=stack.pop()
    childs=G[pare]
    ans*=nCr(K-1-grand,len(childs)-grand)*fac[len(childs)-grand]
    ans%=MOD
    grand=1
    for i in childs:
        if i==gpare:
            continue
        if A[i]-1==0:
            continue
        stack.append([i,pare])
print(ans)
a, b = map(int, input())

c = a*b

if c%2 == 0:
    print('Even')
else:
    print('Odd')

### FIXED CODE ###

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

c = a*b

if c%2 == 0:
    print('Even')
else:
    print('Odd')
import sys
a,op,c=sys.stdin.readline().split()
def ope(a,op,b):
    if op == '+': ret = a + b
    if op == "-": ret = a - b
    if op == "*": ret = a * b
    if op == "/": ret = a / b
    return ret
print(ope(a,op,b))

### FIXED CODE ###

import sys
def ope(a,op,b):
	if op == '+': ret = a + b
	if op == '-': ret = a - b
	if op == '/': ret = int(a / b)
	if op == '*': ret = a * b
	if op == r'?': ret = 'end'
	return ret

while True:
	a,op,b = sys.stdin.readline().split()
	ret = ope(int(a) , op , int(b))
	if ret == 'end': break
	else: print(ret)
n = int(input())
a = sorted(set(list(map(int, input().split()))))

la = len(a)
if la == 1:
    print(0)
    exit()
l = [True] * la
for i in range(1, n):
    for j in range(i):
        if a[i] % a[j] == 0:
            l[i] = False
            break
print(l.count(True))

### FIXED CODE ###

from collections import Counter

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

B = Counter(A)
Key = list(B.keys())
Key.sort()

M = 10 ** 6
table = [1] * (M + 1)
cnt = 0
for k in Key:
    if B[k] == 1 and table[k] == 1:
        cnt += 1
    
    for i in range(M):
        if k * i > M:
            break
        else:
            table[k * i] = 0
print(cnt)
#!/usr/bin/env python3
# input
n, m = map(int, input().split())
persons = []
checks = []
for i in range(n):
    point = tuple(map(int, input().split()))
    persons.append(point)
for i in range(m):
    point = tuple(map(int, input().split()))
    checks.append(point)

# print(persons)
# print(checks)
    
def get_distance(person, check):
    return abs(person[0] - check[0]) + abs(person[1] - check[1])
    
for i in range(n):
    min_distance = 10 ** 10
    min_distance_point_num = -1

    # calculate min distance from n to each m
    for j in range(m):
        distance = get_distance(persons[i], checks[j])
        if distance < min_distance:
            min_distance = distance
            min_distance_point_num = j + 1

    print(min_distance_point_num)


### FIXED CODE ###

#!/usr/bin/env python3
a, b = map(int, input().split())
print((a+b) % 24)
import math
 
N = int(input())
X = list(map(int, input().split()))
sum = 0
all = True
for a in X:
    sum = sum + a
C = int(sum / N + 0.5)
ans = 0
for b in X:
    ans = ans + (b-C)**2
print(ans)

### FIXED CODE ###

N,R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(R+(100*(10-N)))
import numpy as np
N = int(input())
A = list(map(int, input().split()))
B = np.argsort(A)+1
print (' '.join(map(str,B)))

### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int, input().split()))
B = np.argsort(A)+1
print (' '.join(map(str,B)))
key_no = input()
ret = 'Good'
for i in range(len(key_no)-1):
  if key_no[i] == key_no[i+1]:
    ret = 'Bad'
  	break
print(ret)

### FIXED CODE ###

key_no = input()
ret = 'Good'
for i in range(len(key_no)-1):
  if key_no[i] == key_no[i+1]:
    ret = 'Bad'
    break  
print(ret)
from sys import stdin, stdout
from collections import deque

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def submasks(m):
	s = m
	while s > 0:
		s = (s-1)&m
		yield s

def main():
	n, m, x = rli()
	A = []
	for _ in range(n):
		A.append(list(rli()))
	mask = 0
	for i in range(n):
		mask |= (1 << i)

	opt = INF

	def process(s):
		nonlocal opt
		i = 0
		cost = 0
		algs = [0 for _ in range(m)]
		while s:
			s, bit = divmod(s, 2)
			if bit:
				cost += A[i][0]
				for j in range(1, m+1):
					algs[j-1] += A[i][j]
			i += 1
		if all(skill >= x for skill in algs):
			opt = min(opt, cost)

	process(mask)
	for s in submasks(mask):
		process(s)

	print(opt if opt < INF else -1)
	stdout.close()

if __name__ == "__main__":
	main()

### FIXED CODE ###

from sys import stdin, stdout

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n, m, x = rli()
	A = []
	for _ in range(n):
		A.append(list(rli()))
	mask = 0
	for i in range(n):
		mask |= (1 << i)

	opt = INF

	def process(s):
		nonlocal opt
		i = 0
		cost = 0
		algs = [0 for _ in range(m)]
		while s:
			s, bit = divmod(s, 2)
			if bit:
				cost += A[i][0]
				for j in range(1, m+1):
					algs[j-1] += A[i][j]
			i += 1
		if all(skill >= x for skill in algs):
			opt = min(opt, cost)

	process(mask)
	s = mask
	while s > 0:
		process(s)
		s = (s-1) & mask

	print(opt if opt < INF else -1)
	stdout.close()

if __name__ == "__main__":
	main()
k,n=map(int,input().split())
a=list(map(int,input().split()))
ans=10**9
for i in range(n):
  s=a[i]
  t=0
  for j in range(1,n):
    m=min(abs(s-a[i-j]),abs(s+20-a[i-j]),abs(s-a[i+j]),abs(20-s+a[i+j]))
    t=t+m
    s=a[i-j]
  ans=min(ans,t)
print(ans)

### FIXED CODE ###

k,n=map(int,input().split())
a=list(map(int,input().split()))
t=0
for i in range(1,n):
  t=max(t,a[i]-a[i-1])
s=max(t,k-a[n-1]+a[0])
print(k-s)
N, D = map(int, input().split())
ans = 0
for i in range(N)
  X, Y = map(int, input().split())
  if X*X+Y*Y<=D:
    ans += 1
print(ans)


### FIXED CODE ###

N, D = map(int, input().split())
ans = 0
for i in range(N):
  X, Y = map(int, input().split())
  if X*X+Y*Y<=D*D:
    ans += 1
print(ans)
s = list(map(int,input()))
cnt = 0
def func(s):
    for i, a in enumerate(zip(s, s[1:])):
        if a[0]^a[1] == 1:
            global cnt
            cnt += 2
            s.pop(i)
            s.pop(i)
            return func(s)

func(s)
print(cnt)

### FIXED CODE ###

s = input()
zero = s.count('0')
one = s.count('1')
print(2*min(zero, one))
import math
a,b,c = map(int,input().split())
if math,sqrt(a) + math,sqrt(b) < math,sqrt(c):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

a,b,c = map(int,input().split())
if c-a-b<=2:
  print("No")
else:
  if (c-a-b)**2-4*a*b>0:
    print("Yes")
  else:
    print("No")
l = list(map(int,input().split()))
k = int(input())
L =l.sorted()
print(l[0]+l[1]+l[2]*(k*2))


### FIXED CODE ###

a,b,c = map(int,input().split())
k = int(input())
print(a+b+c-max(a,b,c)+max(a,b,c)*(2 ** k))
x, y, z =  input().split()

if x + y + z = 17:
  print ("YES")
else:
  print ("NO")

### FIXED CODE ###

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

if x + y + z == 17:
  print ("YES")
else:
  print ("NO")
a = input("input a: ")
a = int (a)
b = input("input b: ")
b = int (b)
area = a*b
line = 2*a + 2*b
print( area, line )

### FIXED CODE ###

a, b = map(int, input().split())
print ( a*b, 2*a+2*b )
n = int(input())
m = [[-1 for i in range(n)] for j in range(n)] #お隣さんへのコストを保存（この中から最小を探す）

v = set()
v.add(0)

for i in range(n): #隣接の辺のコストを入力
  nums = list(map(int, input().split()))
  for j in range(n):
    m[i][j] = nums[j]


def prim_mst(n):
  isVisited = [False] * n
  d = [0] + [2001] * (n-1)      #TとV-Tのを繋ぐ最小辺の重みを格納する

  while  True:
    mincost = 2001
    for i in range(n):
      if not (isVisited[i]) and d[i] < mincost:
        mincost = d[i]
        u = i
    isVisited[u] = True


    if mincost == 2001:        #mincostが2001になったら繰り返し作業終了
      break

    for v in range (n):
      if (not isVisited[v]) and (m[u][v] != -1):
        if m[u][v] < d[v]:
          d[v] = m[u][v]
  print(sum(d))

prim_mst(n)



### FIXED CODE ###

def root(x):
  if par[x] == x:
    return x
  par[x] = root(par[x])
  return par[x]

def same(x, y):
  return root(x) == root(y)

def unite(x, y):
  x = root(x)
  y = root(y)
  par[x] = y

v, e = map(int,input().split())
adj = [list(map(int, input().split())) for i in range(e)]
adj.sort(key = lambda x:x[2])
par = [i for i in range(v)]
sum = 0

for i, j, k in adj:
  if not same(i, j):
    sum += k
    unite(i, j)
print(sum)
N ,L = map(int,input().split())
lis = []
for i in range(N):
  lis.append(L+i)

mini = 100
index = ""
for i in range(N):
  if mini > abs(lis[i]):
    mini = abs(lis[i])
    index = i

print(sum(lis)-lis[index])

### FIXED CODE ###

N ,L = map(int,input().split())
lis = []
for i in range(N):
  lis.append(L+i)

mini = 100
index = 0
for i in range(N):
  if mini > abs(lis[i]):
    mini = abs(lis[i])
    index = i

print(sum(lis)-lis[index])
s=input()
clist=['A','C','G','T']
count=0
a=[]
for i in s:
  if i in clist:
    count+=1
  else:
    a.append(count)
    count=0
print(max(a))

### FIXED CODE ###

s=input()
clist=['A','C','G','T']
count=0
a=[]
for i in s:
  if i in clist:
    count+=1
  else:
    a.append(count)
    count=0
a.append(count)
print(max(a))
from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

def main():
    N, K = map(int, input().split())
    max_ = cmb(N - 1, 2)
    if N <= 2 or K > max_:
        print(-1)
        return
    M = N - 1 + max_ - K
    print(M)
    for i in range(2, N + 1):
        print(1, i)
    for i in range(2, 2 + max_ - K):
        print(i, i + 1)


main()

### FIXED CODE ###

import itertools

def main():
    N, K = map(int, input().split())
    max_ = int((N - 1) * (N - 2) / 2)
    if K > max_:
        print(-1)
        return
    M = N - 1 + max_ - K
    print(M)
    for i in range(2, N + 1):
        print(1, i)
    for u, v in [(x[0], x[1]) for x in itertools.combinations(range(2, N + 1), 2)][:max_ - K]:
        print(u, v)

main()
i = int(input())
degree = 180 * (i - 2)
print(degree

### FIXED CODE ###

i = int(input())
degree = 180 * (i - 2)
print(degree)
i = int(input())
l = 2*i*math.pi
print(l)

### FIXED CODE ###

i = int(input())
l = 2*i*3.141592
print(l)