Harryxun/stf_run huggingface dataset:
import sys
import math
import numpy as np
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    N ,W = I2()
    w = [0]*N
    v = [0]*W
    dp = [[0]*N+1 for i in range(W+1)]
    for i in range(N):
        a,b = I2()
        w[i] = a
        v[i] = b
    for i in range(N):
        for j in range(0,W+1):
            if(j >= w[i]):
                dp[i+1][j] = max(dp[i+1][j],dp[i][j-w[i]] + v[i])
            dp[i+1][j] = max(dp[i+1][j],dp[i][j])
            #print(dp)
    print(dp[N][W])

### FIXED CODE ###

import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    N ,W = I2()
    w = [0]*N
    v = [0]*W
    dp = [[0]*(W+1)for _ in range(N+1)]
    for i in range(N):
        a,b = I2()
        w[i] = a
        v[i] = b
    for i in range(N):
        for j in range(0,W+1):
            if(j >= w[i]):
                dp[i+1][j] = max(dp[i+1][j],dp[i][j-w[i]] + v[i])
            dp[i+1][j] = max(dp[i+1][j],dp[i][j])
            #print(dp)
    print(dp[N][W])
import itertools
n = int(input())
a = list(map(int,input().split()))
s = itertools.permutations(n,3)
count = 0
for i in range(len(s)):
  r = [a[s[0]],a[s[1]],a[s[2]]]
  if (sum(r) - max(r)) >= max(r):
    count += 1
print(count)

### FIXED CODE ###

import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        r = bisect.bisect_left(l,l[i]+l[j])
        ans += r-(j+1)
print(ans)
N, M = map(int, input().split())

S, C = [], []
for i in range(M):
  s, c = map(int, input().split())
  S += [s-1]
  C += [str(c)]
  
if N == 1:
  for i in range(10):
    flag = 1
  for m in range(M):
      if i_str[S[m]] != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1) 
else:
  for i in range(10**(N-1), 10**N):
    flag = 1
    i_str = str(i)
    for m in range(M):
      if i_str[S[m]] != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1)

### FIXED CODE ###

print(((int(input()))+1)//2)
input_str = input()

split_list = input_str.split()

print((int(split_list[0]) * int(split_list[1]),(int(split_list[0]) * 2 + int(split_list[1]) * 2))
 

### FIXED CODE ###

input_str = input()

split_list = input_str.split()

print(int(split_list[0]) * int(split_list[1]), int(split_list[0]) * 2 + int(split_list[1]) * 2)
n, d = list(map(int, input().split()))
points = []
for i in range(n):
  points.append(list(map(int, input().split())))
  
cnt = 0
for p in points:
  distance = sqrt(p[0] **2 + p[1] **2)
  if distance <= d:
    cnt += 1
print(cnt)
   

### FIXED CODE ###

n, d = list(map(int, input().split()))
points = []
for i in range(n):
  points.append(list(map(int, input().split())))
  
cnt = 0
import numpy as np
for p in points:
  distance = np.linalg.norm(p)
  if distance <= d:
    cnt += 1
print(cnt)
A=int(input())
B=int(input())
X=int(input())
if A<=X and X<=A+B:
	print("YES")
else :
	print("NO")

### FIXED CODE ###

A, B, X = map(int, input().split())
if A<=X and X<=A+B:
	print("YES")
else :
	print("NO")
K = int(input())
S = input()

a = len(S)


if a =< K:
    print(S)
else:
    print(S[:K] + ("..."))
    

### FIXED CODE ###

K = int(input())
S = input()

a = len(S)


if a <= K:
    print(S)
else:
    print(S[:K] + ("..."))
def main():
    n, m = list(map(int, input().split()))
    dcon = [set() for _ in range(n)]
    for _ in range(m):
        s, c = tuple(map(int, input().split()))
        dcon[s-1].add(c)

    if any(len(d) > 1 for d in dcon):
        print(-1)
        return
    
    digits = [0] if n == 1 else [1] + [0] * (n-1)
    for i in range(n):
        if d:
            digits[i] = d.pop()

    print(''.join(map(str, digits)))

main()


### FIXED CODE ###

def main():
    n, m = list(map(int, input().split()))
    dcon = [set() for _ in range(n)]
    for _ in range(m):
        s, c = tuple(map(int, input().split()))
        dcon[s-1].add(c)

    if any(len(d) > 1 for d in dcon):
        print(-1)
        return
    
    digits = [0] if n == 1 else [1] + [0] * (n-1)
    for i in range(n):
        if dcon[i]:
            digits[i] = dcon[i].pop()

    if digits[0] == 0 and n != 1:
        print(-1)

    else:
        print(''.join(map(str, digits)))

main()
import sys
sys.setrecursionlimit(1000000)

I=list(map(int,Input.split()))
n=I.pop(0)
u=I.pop(0)
v=I.pop(0)
Graph=[]
for i in range(n):
    Graph.append([])
for i in range(n-1): #隣接頂点の登録
    a=I.pop(0)
    b=I.pop(0)
    Graph[a-1].append(b-1)
    Graph[b-1].append(a-1)

def dfs(s,b=-1): #深さ優先探索(グラフ,スタート,深さ)
    for i in Graph[s]: #隣接点に対して
        if i!=b: #前の点と一緒じゃないとき
            depth[i]=depth[s]+1
            dfs(i,s) #深さを増やし、スタートを更新して再探索

depth=[0]*n
dfs(u-1)
dT=depth

depth=[0]*n
dfs(v-1)
dA=depth

print(max(dT),max(dA))

dArrest=0
for i in range(n):
    if dA[i]>dT[i]: #Tが先に着ける点のうち
        dArrest=max(dArrest,dA[i]) #一番Aから遠い点
print(dArrest-1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

n,u,v=map(int,input().split())
Graph=[]
for i in range(n):
    Graph.append([])
for i in range(n-1): #隣接頂点の登録
    a,b=map(int,input().split())
    Graph[a-1].append(b-1)
    Graph[b-1].append(a-1)

def dfs(s,b=-1): #深さ優先探索(グラフ,スタート,深さ)
    for i in Graph[s]: #隣接点に対して
        if i!=b: #前の点と一緒じゃないとき
            depth[i]=depth[s]+1
            dfs(i,s) #深さを増やし、スタートを更新して再探索

depth=[0]*n
dfs(u-1)
dT=depth

depth=[0]*n
dfs(v-1)
dA=depth

dArrest=0
for i in range(n):
    if dA[i]>dT[i]: #Tが先に着ける点のうち
        dArrest=max(dArrest,dA[i]) #一番Aから遠い点
print(dArrest-1)
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=0
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=sum([A[i]//x for i in range(N)]) # x以下にするための回数
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)

### FIXED CODE ###

import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=1
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=0
    for i in range(N):
        if A[i]%x==0:
            m+=A[i]//x-1
        else:
            m+=A[i]//x
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)
import sys
input = sys.stdin.readline

import numpy as np

N,M,R = map(int, input().split())
r = list(map(int, input().split()))
ds = np.zeros([N,N])
neighbors = [[]]*N
for _ in range(M):
    a,b,c = map(int, input().split())
    ds[a-1][b-1] = c
    ds[b-1][a-1] = c
    neighbors[a-1].append(b-1)
    neighbors[b-1].append(a-1)
visitedls = []
totalds = 0
minds = 1e9+7

def dfs(a, prev):
    global visitedls, totalds, ds, minds, neighbors, r
    visitedls.append(a+1)
    totalds += ds[a][prev]
    if set(r) & set(visitedls) == set(r):
        if minds > totalds:
                minds = totalds  
    for nxt in neighbors[a]:
        if nxt+1 not in visitedls:
            dfs(nxt, a)
    del visitedls[-1]
    totalds -= ds[a][prev]

for a in r:
    dfs(a-1, a-1)
print(int(minds))
    

### FIXED CODE ###

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

adj = [[] for i in range(N)]
for i in range(M):
    A, B, C = map(int, input().split())
    adj[-A].append((B, C))
    adj[-B].append((A, C))

import heapq

def Dijkstra(N, v_st, v_go):
    cost = [float('inf') for i in range(N)]

    pq = []
    heapq.heappush(pq, (0, v_st))

    while pq:
        c, v_now = heapq.heappop(pq)

        if v_now == v_go:
            return c

        if cost[-v_now] < c:
            continue

        cost[-v_now] = c

        for v, c2 in adj[-v_now]:
            if cost[-v_now] + c2 < cost[-v]:
                cost[-v] = cost[-v_now] + c2
                heapq.heappush(pq, (cost[-v], v))

cost_min = [[float('inf') for i in range(R)] for j in range(R)]

for i in range(R):
    for j in range(i, R):
        cost_min[i][j] = Dijkstra(N, r[i], r[j])
        cost_min[j][i] = cost_min[i][j]

import itertools
p = list(itertools.permutations(range(R)))

ans = float('inf')
for pp in p:
    c = 0
    for i in range(R - 1):
        c += cost_min[pp[i]][pp[i + 1]]

    ans = min(ans, c)
    
print(ans)
s,t=input().split()
a,b=map(int,input().split())
u=input()
if u = s:
  a -=1
else:
  b -=1
print(a,b)

### FIXED CODE ###

s,t=input().split()
a,b=map(int,input().split())
u=input()
if u == s:
  a -=1
else:
  b -=1
print(a,b)
import numpy as np
n = int(input())
cnt = [0 for i in range(10**6)]

for ai in a:
  cnt[int(input())-1] += 1
  
print( (np.array(cnt) % 2).sum())

### FIXED CODE ###

from collections import Counter
n = int(input())
a = Counter([int(input()) for i in range(n)])

cnt = 0
for k, v in a.items():
  if v % 2 == 1:
    cnt += 1
print(cnt)
N = int(input())
A = []
sA = []
for i in range(N):
    a = int(input())
    A.append(a)
    sA.append(a)

sA.sort(reverse=True)

f = sA[0]
s = sA[1]

for i in range(N):
    if A[i] == f:
        print(s)
    else:


### FIXED CODE ###

N = int(input())
A = []
sA = []
for i in range(N):
    a = int(input())
    A.append(a)
    sA.append(a)

sA.sort(reverse=True)

f = sA[0]
s = sA[1]

for i in range(N):
    if A[i] == f:
        print(s)
    else:
        print(f)
while 1:
 n=int(input())
 if n:
  s=list(map(int,input().split()))
  c=0
  while 1:
   t=s;s=[t.count(e)for e in t]
   if t==s:break
   c+=1
  print(c);print(*s)


### FIXED CODE ###

import sys
a=sys.stdin
while 1:
 if'0\n'==a.readline():break
 s=list(map(int,a.readline().split()))
 c=0
 while 1:
  t=s;s=[t.count(e)for e in t]
  if t==s:break
  c+=1
 print(c);print(*s)
def ABC_135_A():
    A,B = map(int, input().split())

    if (A+B)/%2 == 0:
        print(int((A+B)/2))
    else:
        print('IMPOSSIBLE')

if __name__ == '__main__':

    ABC_135_A()

### FIXED CODE ###

def ABC_135_A():
    A,B = map(int, input().split())

    if (A+B)%2 == 0:
        print(int((A+B)/2))
    else:
        print('IMPOSSIBLE')

if __name__ == '__main__':

    ABC_135_A()
#!/usr/bin/env python3
import sys
from scipy.special import comb
sys.setrecursionlimit(10**4)


def f(S, i, k):
    # ここに来るのは繰り下がりが発生していない状態...
    if k == 0:
        # 以降は0を選び続けるしかない
        return 1
    if len(S) <= i:
        # 走破したのにK個使いきれていない
        return 0
    n = int(S[i])
    if n == 0:
        # 注目する桁が0の場合、0を選ぶしかない
        return f(S, i+1, k)
    # 注目する桁の数値nより小さい値を選べば、以降は繰り下げで選び放題
    ret = (n - 1) * comb(len(S)-i-1, k-1, exact=True) * pow(9, k-1)
    ret += comb(len(S)-i-1, k, exact=True) * pow(9, k)
    # 注目する桁の数値nを選んだ場合、繰り下げができない状態が続行    
    ret += f(S, i+1, k-1)
    return ret

def solve(S: str, K: int):
    return f(S, 0, K)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    print(solve(N, K))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
# from scipy.special import comb
sys.setrecursionlimit(10**4)
from math import factorial

def comb(n, r):
    '''
    >>> comb(2, 1)
    2
    >>> comb(3, 2)
    3
    '''
    if r == 0:
        return 1
    if n == 0 or r > n:
        return 0
    return factorial(n) // factorial(n - r) // factorial(r)

def f(S, i, k):
    # ここに来るのは繰り下がりが発生していない状態...
    if k == 0:
        # 以降は0を選び続けるしかない
        return 1
    if len(S) <= i:
        # 走破したのにK個使いきれていない
        return 0
    n = int(S[i])
    if n == 0:
        # 注目する桁が0の場合、0を選ぶしかない
        return f(S, i+1, k)
    # 注目する桁の数値nより小さい値を選べば、以降は繰り下げで選び放題
    ret = (n - 1) * comb(len(S)-i-1, k-1) * pow(9, k-1)
    ret += comb(len(S)-i-1, k) * pow(9, k)
    # 注目する桁の数値nを選んだ場合、繰り下げができない状態が続行    
    ret += f(S, i+1, k-1)
    return ret

def solve(S: str, K: int):
    return f(S, 0, K)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    print(solve(N, K))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    test()
    main()
# AtCoder Beginner Contest 157
# E - Simple String Queries
# https://atcoder.jp/contests/abc157/tasks/abc157_e
from bisect import bisect_left, insort_left
from collections import defaultdict


_, S, _, *Q = open(0).read().split()
Q = tuple(zip(*[iter(Q)]*3))

D = defaultdict(list)

for i, s in enumerate(S):
    D[s].append(i)

for q, *x in Q:
    if int(q) == 1:
        i, c = x
        i = int(i) - 1

        d = D[S[i]]
        i = bisect_left(d, i)
        d.pop(i)

        d = D[c]
        insort_left(d, i)

    else:
        l, r = map(int, x)
        l -= 1
        r -= 1
        cnt = 0
        for L in D.values():
            i = bisect_left(L, l)
            if i == len(L):
                continue
            if L[i] <= r:
                cnt += 1

        print(cnt)


### FIXED CODE ###

# AtCoder Beginner Contest 157
# E - Simple String Queries
# https://atcoder.jp/contests/abc157/tasks/abc157_e
from bisect import bisect_left, insort_left
import sys
input = sys.stdin.readline
OFS = ord('a')
_ = input()
S = list(input()[:-1])

D = [[] for _ in [0]*26]
for i, s in enumerate(S):
    D[ord(s)-OFS].append(i)

for _ in [0]*int(input()):
    Q = input()[:-1].split()
    if Q[0] == '1':
        i, c = int(Q[1])-1, Q[2]

        if S[i] != c:
            s = ord(S[i])-OFS
            D[s].pop(bisect_left(D[s], i))
            insort_left(D[ord(c)-OFS], i)
            S[i] = c

    else:
        l, r = int(Q[1])-1, int(Q[2])-1

        cnt = 0
        for L in D:
            i = bisect_left(L, l)
            if i < len(L) and L[i] <= r:
                cnt += 1

        print(cnt)
hx = h * x
hx2 = h * (w-x)
wy = w * y
wy2 = w * (h-y)

if(hx > hx2) :
    d1 = hx2
else :
    d1 = hx

if(wy > wy2) :
    d2 = wy2
else :
    d2 = wy


if(d1 == d2) :
    ff = 1
else :
    ff = 0

if(d1 > d2) :
    print(str(d1) + " " + str(ff))
else :
    print(str(d2) + " " + str(ff))

### FIXED CODE ###

w,h,x,y = map(int,input().split())

if(2*x == w and 2*y ==h) :
    ff = 1
else :
    ff = 0

print(str(w * h / 2) + " " + str(ff))
a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())
d = abs(a-b)
ss = v+w
ms = abs(w-v)
if not d%ss and d/ss <= t:
  print("YES")
elif not d%ms and d/ms <= t:
  print("YES")
else:
  print("NO")
  

### FIXED CODE ###

a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())
d = abs(a-b)
s = v - w
if s > 0 and d/s <= t:
  print("YES")
else:
  print("NO")
a = input()
if 'AC' in s:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a = input()
if 'AC' in a:
  print('Yes')
else:
  print('No')
n,x = map(int,input().split())
L = list(map(int,input().split()))
D = 0
c = 0

while D <= x:
	D += L[c]
	c += 1
print(c)

### FIXED CODE ###

n,x = map(int,input().split())
L = list(map(int,input().split()))
D = 0
c = 0

for i in range(n):
	if D <= x:
		c += 1
	D += L[i]
if D <= x:
	print(c+1)
else:
	print(c)
a,op,b=input().split()
print(int(a)+input(op)+int(b))

### FIXED CODE ###

print(eval(input()))
l = input().split()
A = int(l[0])
B = int(l[1])
AB = int(l[2])
a = int(l[3])
b = int(l[4])

sum = 0

if A+B < AB*2:
    if a < b:
        sum += a*AB
        sum += b*B
    else:
        sum += b*AB
        sum += a*A
else:
    sum += a*A + b*B

print sum


### FIXED CODE ###

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

sum = 0
a = b = c = 0

if l[0] > l[2]*2 or l[1] > l[2]*2:
    c1 = c2 = 0
    if l[0] > l[2]*2:
        c1 = 2 * l[3]
    if l[1] > l[2]*2:
        c2 = 2 * l[4]
    c = max([c1, c2])
elif l[0]+l[1] > l[2]*2:
    c += min([l[3], l[4]])*2
else:
    a = l[3]
    b = l[4]


if a+c/2 < l[3]:
    a += l[3]-(c/2+a)
if b+c/2 < l[4]:
    b += l[4]-(c/2+b)

sum = a*l[0] + b*l[1] + c*l[2]

print(int(sum))
n=int(input())

div1 = 1
div2 = n
result = 10**12
if n == 1:
  print('0')
  exit()

for i in range(1,int(-(-n**0.5//1))+1):
  if n % i == 0:
    div1 *= i
    div2 /= i
    div_sum = div1 + div2
    result = min(result, div_sum)
print(int(result-2))


### FIXED CODE ###

n=int(input())

div = n
result = 10**12

for i in range(1,1000001):
  if n % i == 0:
    div = n // i
    result = min(result, i+div)

print(int(result-2))
n,k=map(int, input().split())
r,s,p=map(int, input().split())
t=input()
ans=0
for i in range(k):
  u=s[i::k]
  u=u.replace("rr", "rx")
  u=u.replace("pp", "px")
  u=u.replace("ss", "sx")
  ans+=u.count("s")*r
  ans+=u.count("p")*s
  ans+=u.count("r")*p
print(ans)

### FIXED CODE ###

n,k=map(int, input().split())
r,s,p=map(int, input().split())
t=input()
ans=0
for i in range(k):
  u=t[i::k]
  u=u.replace("rr", "rx")
  u=u.replace("pp", "px")
  u=u.replace("ss", "sx")
  ans+=u.count("s")*r
  ans+=u.count("p")*s
  ans+=u.count("r")*p
print(ans)
def solve():
    while 1:
        N = int(input())
        D = list(map(int, input(" ")))
        M = int(input())
        if N < M:
            print("NO")
            break   
        T = list(map(int, input(" ")))
        
        for t in T:
            if t not in D:
                print("NO")
                break
        
        print("YES")
        break


solve()

### FIXED CODE ###

def solve():
    while 1:
        try:
            N = int(input())
            D = list(map(int, input().split(" ")))
            M = int(input())
            T = list(map(int, input().split(" ")))
            D_dict = {}
            T_dict = {}
            for d in D:
                if d not in D_dict:
                    D_dict[d] = 1
                else:
                    D_dict[d] += 1

            for t in T:
                if t not in T_dict:
                    T_dict[t] = 1
                else:
                    T_dict[t] += 1

            for key, val in T_dict.items():
                if key not in D_dict:
                    print("NO")
                    raise EndLoop
                else:
                    if val > D_dict[key]:
                        print("NO")
                        raise EndLoop

            print("YES")
            break
        except:
            break


solve()
import math
print(math.ceil(int(input)/2))

### FIXED CODE ###

import math
print(math.ceil(int(input())/2))
A = int(input('A'))
P = int(input('P'))

P = P + 3 * A
k = P//2
print(k)


### FIXED CODE ###

A, P =map(int, input().split())
pie = (A * 3 + P)//2
print(pie)
food = [int(input()) for _ in range(5)]

total = 0
compare = 0
largest = 0

for x in food:
    if (10 - (x % 10) and (x % 10) != 0) > compare:
        largest = x
food.remove(largest)

for i in range(len(food)):
    if food[i] % 10 != 0:
        total += round(food[i] + 5.1, -1)
    else:
        total += food[i]
print(int(total+largest))


### FIXED CODE ###

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

total = 0
compare = 0
largest = 0

if sum(food)%10 == 0:
    print(sum(food))

else:
    for x in food:
        if (10 - (x % 10) > compare) and ((x % 10) != 0):
            largest = x
            compare = 10 - (x % 10)

    food.remove(largest)

    for i in range(len(food)):
        if food[i] % 10 != 0:
            total += round(food[i] + 5.1, -1)
        else:
            total += food[i]

    print(int(total+largest))
def prod(li, MOD):
    ret = 1
    for a in li:
        ret *= a
        ret %= MOD
    return ret

N, K = map(int, input().split())
MOD = 1_000_000_007
aaa = list(map(int, input().split()))
if N == K:
    print(prod(aaa, MOD))
    exit()
aaa.sort(key=lambda x : abs(x))
if sum(a < 0 for a in aaa[-K:]) % 2 == 0:
    print(prod(aaa[-K:], MOD))
else:
    if all(a <= 0 for a in aaa):
        print(prod(aaa[:K], MOD))
    elif all(a <= 0 for a in aaa[:-K]):
        for a in aaa[-K:][::-1]:
            if a > 0:
                break
        bbb = aaa[-K:].remove(a)
        bbb.append(aaa[-(K + 1)])
        print(prod(bbb, MOD))
    elif all(a > 0 for a in aaa[:-K]):
        for a in aaa[-K:][::-1]:
            if a < 0:
                break
        bbb = aaa[-K:].remove(a)
        bbb.append(aaa[-(K + 1)])
        print(prod(bbb, MOD))
    else:
        bbb = aaa[-(K-1):]
        for a in aaa[:-K][::-1]:
            if a * aaa[-K] <= 0:
                bbb.append(a)
                break
        print(prod(bbb, MOD))


### FIXED CODE ###

def prod(li, MOD):
    ret = 1
    for a in li:
        ret *= a
        ret %= MOD
    return ret

N, K = map(int, input().split())
MOD = 1_000_000_007
aaa = list(map(int, input().split()))
if N == K:
    print(prod(aaa, MOD))
    exit()
aaa.sort(key=lambda x : abs(x))
if sum(a < 0 for a in aaa[-K:]) % 2 == 0:
    print(prod(aaa[-K:], MOD))
else:
    if all(a <= 0 for a in aaa):
        bbb = aaa[:K]
    else:
        try:
            x1, y1 = min([a for a in aaa[-K:] if a > 0]), min([a for a in aaa[:-K] if a < 0])
        except:
            x1, y1 = 1, 0
        try:
            x2, y2 = max([a for a in aaa[-K:] if a < 0]), max([a for a in aaa[:-K] if a >= 0])
        except:
            x2, y2 = 1, 0
        bbb = aaa[-K:]
        if abs(x2 * y1) > abs(x1 * y2):
            bbb.remove(x1)
            bbb.append(y1)
        else:
            bbb.remove(x2)
            bbb.append(y2)
    print(prod(bbb, MOD))
a, b = map(int, input().split())
c = a+b
d = a-b
e = a*b
print(max(c, d. e))

### FIXED CODE ###

a, b = map(int, input().split())
print(max(a+b,a-b,a*b))
n, a, b = map(int, input().split())
mod = 10**9 + 7
ans = 0
MAX = 500000
fac = [1, 1] + [0] * MAX
finv = [1, 1] + [0] * MAX
inv = [0, 1] + [0] * MAX
for i in range(2, MAX):
    fac[i] = fac[i - 1] * i % mod
    inv[i] = -inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def neko(n, r):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod


if n % 2:
    for i in range((n + 1) // 2):
        ans += neko(n, i) * 2 % mod
    ans -= neko(n, a)
    ans -= neko(n, b)
    print(max(ans - 1, 0))
else:
    for i in range(n // 2):
        ans += neko(n, i) * 2 % mod
    ans += neko(n, n // 2)
    ans -= neko(n, a)
    ans -= neko(n, b)
    print(max(ans - 1, 0))


### FIXED CODE ###

n, a, b = map(int, input().split())
mod = 10**9 + 7


def neko(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    k = min(n - k, k)
    ans = 1
    inv = [1] * (k + 1)
    if k >= 1:
        ans *= (n - k + 1) % mod
    for i in range(2, k + 1):
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        ans = ans * (n - k + i) * inv[i] % mod
    return ans


print((pow(2, n, mod) - 1 - neko(n, a) - neko(n, b)) % mod)
a=[int(i) for i in input().split()]
a.sort()[::-1]
x,y,z=a
print(x*10+y+z)

### FIXED CODE ###

z,y,x=sorted([int(i) for i in input().split()])
print(x*10+y+z)