Harryxun/stf_run huggingface dataset:
r = int(input())
menseki = r*r*3.1415926
syuu = r*2*3.1415926
print(str(menseki)+" "+str(syuu))

### FIXED CODE ###

import math
r = float(input())
menseki = r*r*math.pi
syuu = r*2*math.pi
print("%.6f" % (menseki),end=" ")
print("%.6f" % (syuu))
import sys
h,w=map(int,input().split())

b=[]
d=[]
for i in range(w):
    d.append(i)

for i in range(h):
    a=input()
    if a!="."*w:
        b.append(a)
    else:
        h-=1
        
for i in range(w):
    c=0
    for j in range(h):
        if b[j][i]=="#":
            c+=1
    if c==0:
        del(d[i])
            
for i in range(h):
    for j in d:
       sys.stdout.write(b[i][j]) 
    print("")

### FIXED CODE ###

import sys
h,w=map(int,input().split())

b=[]
d=[]
k=0
for i in range(w):
    d.append(i)

for i in range(h):
    a=input()
    if a!="."*w:
        b.append(a)
    else:
        h-=1
        
for i in range(w):
    c=0
    for j in range(h):
        if b[j][i]=="#":
            c+=1
    if c==0:
        del(d[k])
    else:
        k+=1
            
for i in range(h):
    for j in d:
       sys.stdout.write(b[i][j]) 
    print("")
import math
def calc_pattern(stairs):
    if stairs<=3:
        return stairs
    d=stairs//2+1
    l=[(math.factorial(i+(stairs-i*2))/math.factorial(i)/math.factorial(stairs-i*2))%1000000007  for i in range(d)]
    return int((sum(l))%1000000007)

N,M=map(int,input().split())
A=[-1]
A.extend([int(input()) for m in range(M)])
A.append(N+1)
s=1
for m in range(M+1):
    if A[m+1]==1 or A[m]==N-1:
        continue
    if A[m]+1==A[m+1]:
        print(0)
        exit()
    else:
        s*=calc_pattern(A[m+1]-1 - (A[m]+1))
        s%=1000000007
print(int(s))


### FIXED CODE ###

N,M=map(int,input().split())
A=[int(input()) for n in range(M)]
S=[1]*(N+1)
for a in A:
  S[a]=0
for i in range(2,N+1):
  S[i]=(S[i-1]+S[i-2])%1000000007*S[i]

print(S[-1])
def main():
    N, M, K = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    time = 0
    i = 0
    while (time + A[i] <= K):
        time += A[i]
        i += 1
        if i == N:
            break

    i2 = i-1#i2はAの一番下の変数を指すポインタ
    h = 0
    while (time + B[h] <= K):
        time += B[h]
        h += 1
        i += 1
        if h == M:
            break
    max = i
    #iは冊数

    i3 = i#今後比べていくときの合計冊数
    #print(time,i)
    if h == M:
        return max

    for j in range(i2+1):
        if i2 < 0:
            return max
        time -= A[i2]
        i3 -= 1
        while (time + B[h] <= K):
            time += B[h]
            h += 1
            i3 += 1
            if h == M:
                break
        #print(time,i3)

        if i3 > max:
            max = i3

        i2 -= 1

    return max

print(main())


### FIXED CODE ###

def main():
    N, M, K = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    time = 0
    i = 0
    while (time + A[i] <= K):
        time += A[i]
        i += 1
        if i == N:
            break

    i2 = i-1#i2はAの一番下の変数を指すポインタ
    h = 0
    while (time + B[h] <= K):
        time += B[h]
        h += 1
        i += 1
        if h == M:
            break
    max = i
    #iは冊数

    i3 = i#今後比べていくときの合計冊数
    #print(time,i)
    if h == M:
        return max

    for j in range(i2+1):
        if i2 < 0:
            return max
        time -= A[i2]
        i3 -= 1
        while (time + B[h] <= K):
            time += B[h]
            h += 1
            i3 += 1
            if h == M:
                break
        #print(time,i3)

        if i3 > max:
            max = i3

        i2 -= 1
        if h == M:
            return max

    return max

print(main())
c, a, b= input().split()
Print(a, b, c) 

### FIXED CODE ###

b, c, a= input().split()
print(a, b, c)
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, D: "List[int]"):
    ln = list(map(int, list(str(N))))
    c = 0
    
    for i in range(len(ln)-1,-1,-1):
        ln[i] += c
        while(ln[i] in D):
            ln[i] += 1
        c = ln[i] // 10
        ln[i] %= 10

    if(c > 0):
        l = [c] + l

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

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    D = [int(next(tokens)) for _ in range(K)]  # type: "List[int]"
    solve(N, K, D)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, K: int, D: "List[int]"):
    
    while(True):
        nl = list(map(int,list(str(N))))
        f = True
        for i in range(len(nl)):
            if(nl[i] in D):
                f = False
        if(f):
            print(N)
            exit()
        else:
            N += 1

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    D = [int(next(tokens)) for _ in range(K)]  # type: "List[int]"
    solve(N, K, D)

if __name__ == '__main__':
    main()
from fractions import gcd
 
d = gcd(*map(int, input().split()))
r = 1
i = 2
while i * i <= d:
    r += d % i == 0:
    while d % i == 0:
        d //= i
    i += 1
print(r + (d > 1))

### FIXED CODE ###

from fractions import gcd

d = gcd(*map(int, input().split()))
r = 1
i = 2
while i * i <= d:
    if d % i == 0:
        d //= i
        r += 1
    while d % i == 0:
        d //= i
    i += 1
print(r + (d > 1))
a, b ,c= map(int, input().split())
if a+b+c > 22 :
print("bust")
else:
  print("win")

### FIXED CODE ###

a, b ,c= map(int, input().split())
if a+b+c >= 22 :
  print("bust")
else:
  print("win")
l = list(input().split())
if l[0][0] == l[1][2] and l[0][1] == l[1][1] and l[0][2] == l[1][0]:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a = input()
b = input()
if a == b[::-1]:
  print("YES")
else:
  print("NO")
n,a,b = map(int, input().split())

shou = n // (a+b)
amari = n % (a+b)

ans = shou*a+a if amari >= a　else shou*a+amari

print(ans)

### FIXED CODE ###

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

shou = n // (a+b)
amari = n % (a+b)

if amari >= a:
    print(shou * a + a)

else: print(shou * a + amari)
num1, num2 = [int(i) for i in input().split()]
if num1 == num2
    print('Yes')
else
    print('No')

### FIXED CODE ###

num1, num2 = [int(i) for i in input().split()]
if num1 == num2:
    print('Yes')
else:
    print('No')
N = raw_input()

A = raw_input().split(' ')

total = 0
B = [0]
dic = {}

for i in range(N):
    total += int(A[i])
    B.append(total)

for b in B:
    if b in dic:
        dic[b] +=1
    else:
        dic[b] = 1
def C(n):
    return int(n*(n-1)/2)

ans = 0;

for k,v in dic.items():
    ans += C(v)

print(ans)


### FIXED CODE ###

N = int(input())

A = input().split(' ')

total = 0
B = [0]
dic = {}

for i in range(N):
    total += int(A[i])
    B.append(total)

for b in B:
    if b in dic:
        dic[b] +=1
    else:
        dic[b] = 1
def C(n):
    return int(n*(n-1)/2)

ans = 0;

for k,v in dic.items():
    ans += C(v)

print(ans)
s=list(input())
ls=len(s)
t=list(input())
lt=len(t)
can=set()
for i in range(ls-lt,-1,-1):
    ok=0
    for j in range(lt):
        if s[i+j]==t[j] or s[i+j]=='?':
            ok+=1
    if ok==lt:
        c=s
        for k in range(ls):
            if c[k]=='?':
                if k<i:
                    c[k]='a'
                else:
                    c[k]=t[k-i]
        can.add(''.join(c))
if len(can)==0:
    print('UNRESTORABLE')
else:
    print(list(can)[0])

### FIXED CODE ###

s=list(input())
ls=len(s)
t=list(input())
lt=len(t)
can=[]
for i in range(ls-lt,-1,-1):
    ok=0
    for j in range(lt):
        if s[i+j]==t[j] or s[i+j]=='?':
            ok+=1
    if ok==lt:
        c=[0]*ls
        for k in range(ls):
            if s[k]=='?':
                if k<i or k>=i+lt:
                    c[k]='a'
                else:
                    c[k]=t[k-i]
            else:
                c[k]=s[k]
        can.append(''.join(c))
if len(can)==0:
    print('UNRESTORABLE')
else:
    print(sorted(list(can))[0])
n,x,m = list(map(int,input().split()))

ans = x % m
#dic = dict()
dicNum = dict()
dicSum = dict()
dicNum[x] = 1
dicSum[1] = x

if n > 10000:
    for i in range(2,n+1):
        b = x
        x = x**2 % m
        if x in dicNum.keys():
            t = i - dicNum[x]
            zan = n - i + 1
            k = zan // t
            ans += (dicSum[i-1] - dicSum[dicNum[x]-1]) * k
            if zan% t != 0:
                zan = zan % t
                ans += dicSum[dicNum[x] - 1 + zan] - dicSum[dicNum[x]-1]
            break
        else:
            ans += x
            dicSum[i] = ans
            #dic[x] = ans
            dicNum[x] = i

else:
    for i in range(2,n+1):
        x = x**2 % m
        ans += x
        dicSum[i] = ans
        #dic[x] = ans
        dicNum[x] = i

print(ans)

### FIXED CODE ###

n,x,m = list(map(int,input().split()))

if x == 0:
    ans = 0
else:
    ans = x % m
dicNum = dict()
dicSum = dict()
dicNum[x] = 1
dicSum[1] = x
dicSum[0] = 0

for i in range(2,n+1):
    b = x
    x = x**2 % m
    if x in dicNum.keys():
        t = i - dicNum[x]
        zan = n - i + 1
        k = zan // t
        ans += (dicSum[i-1] - dicSum[dicNum[x]-1]) * k
        if zan% t != 0:
            zan = zan % t
            ans += dicSum[dicNum[x] - 1 + zan] - dicSum[dicNum[x]-1]
        break
    else:
        ans += x
        dicSum[i] = ans
        dicNum[x] = i

print(ans)
N = int(input())
nn = str(N)
n = len(nn)
ans = []

for i in range(n):
    waru = N % 10
    N = int(N / 10)  
    ans.append(waru)

print(ans)

Sans = sum(ans)       
if Sans % 9 == 0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

N = input()
ans = []

for i in range(len(N)):
    ans.append(N[i])


ys = map((lambda x: int(x)), ans)
Sans = sum(ys)

if Sans % 9 == 0:
    print("Yes")
else:
    print("No")
n = int(input())
v = sotred(list(map(int,input().split())))


for i in range(n-1): # 後に範囲
  v[i+1] = (v[i]+v[i+1])/2

print(v[n-1])


### FIXED CODE ###

n = int(input())
v = sorted(list(map(int,input().split())))
 
 
for i in range(n-1): # 後に範囲
  v[i+1] = (v[i]+v[i+1])/2
 
print(v[n-1])
n,time=(map(int,input().split()))
c=[]
t=[]
for i in range(n):
    C,T=map(int,input().split())
    c.append(C)
    t.append(T)
#print(c)
#print(t)
if min(t)>time:
    print("TLE")
else:
    p=[]
    for i in range(len(t)):
        if t[i]>time:
            p.append(i)
    if len(p)==1:
        print(c[p[0]])
    #print(p)
    for i in p:
        del t[i]
        del c[i]
    print(min(c))

### FIXED CODE ###

n,time=(map(int,input().split()))
c=[]
t=[]
for i in range(n):
    C,T=map(int,input().split())
    c.append(C)
    t.append(T)
#print(c)
#print(t)
if min(t)>time:
    print("TLE")
else:
    for i in range(len(t)):
        if t[i]>time:
            c[i]=max(c)


    #print(c)
    if len(c)==1:
        print(c[0])
    elif len(c)==2:
        if c[0]>=c[1]:
            print(c[1])
        else:
            print(c[0])
    else:
        print(min(c))
ac = 0
wa = 0
tle = 0
re = 0

n = int(input())

for i in range(n):
  s = input()
  if s = 'AC':
    ac += 1
  elif s = 'WA':
    wa += 1
  elif s = 'TLE':
    tle += 1
  elif s = 'RE':
    RE += 1

print('AC','x',ac)
print('WA','x',wa)
print('TLE','x',tle)
print('RE','x',re)

### FIXED CODE ###

ac = 0
wa = 0
tle = 0
re = 0
 
n = int(input())
 
for i in range(n):
  s = str(input())
  if s == 'AC':
    ac += 1
  elif s == 'WA':
    wa += 1
  elif s == 'TLE':
    tle += 1
  elif s == 'RE':
    re += 1

print('AC','x',ac)
print('WA','x',wa)
print('TLE','x',tle)
print('RE','x',re)
n = input()
for i in range(n):
    h,m = map(int, raw_input().split(":"))
    sangle = 1.0 * 360 * (h * 60 + m) / 720
    langle = 1.0 * 360 * m / 60
    angle = abs(sangle - langle)
    if angle > 180:
        angle = 360 - d
    if (0 <= angle < 30):
        print "alert"
    elif (90 <= angle <= 180):
        print "safe"
    else:
        print "warning"

### FIXED CODE ###


n = input()
for i in range(n):
    h,m = map(int, raw_input().split(":"))
    sangle = 1.0 * 360 * (h * 60 + m) / 720
    langle = 1.0 * 360 * m / 60
    angle = abs(sangle - langle)
    if angle > 180:
        angle = 360 - angle
    if (0 <= angle < 30):
        print "alert"
    elif (90 <= angle <= 180):
        print "safe"
    else:
        print "warning"
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ab=[0]*n
for i in range(n): ab[i]=abs(a-(t-h[i]*0.006))
print(h.index(min(ab))+1)

### FIXED CODE ###

n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ab=[0]*n
for i in range(n): ab[i]=abs(a-(t-h[i]*0.006))
print(ab.index(min(ab))+1)
#https://atcoder.jp/contests/abc061/tasks/abc061_d

import sys

# coding: utf-8
# Your code here!

#input_template
inpPh = 2
debug = True
debug = False
if not debug:
    inpPh = 0



    
inploc = inpPh - 1 #0,1,2



inpX_lst = []
if debug and inpPh > 0:
    inpX_lst = inputXs[inploc].splitlines()


if inpPh == 0:
    N,M = tuple(map(lambda x: int(x), sys.stdin.readline().split() ) )
else:
    N,M =tuple( map(lambda x: int(x),  inpX_lst.pop(0).split() ) )

elist = []    

for i in range(M):
    if inpPh == 0:
        ai,bi,ci = list(map(lambda x: int(x), sys.stdin.readline().split() ))
    else:
        ai,bi,ci = list(map(lambda x: int(x), inpX_lst.pop(0).split() ))
    
    ai_loc, bi_loc = ai-1, bi - 1
    elist.append(( ai_loc, bi_loc,ci))

vlist =[ [None,[]] for _ in range(N)]    

for e in elist:
    a,b,c = e
    vlist[a][1].append((a,b,-c))
        
s_loc,g_loc = 0, N-1

vlist[s_loc][0] = 0
#print(vlist)

for v1 in vlist:
    v1_d,v1_elist = v1[0],v1[1]
    #print(v1_d,v1_elist)
    for e in v1_elist:
        a,b,c = e
        v2 = vlist[b]
        v2_d, v2_elist = v2
        if v1_d == None:
            continue
        elif v2_d == None or v2_d > v1_d +c:
            vlist[b][0] = v1_d + c

g0 = vlist[g_loc][0]            

for v1 in vlist:
    v1_d,v1_elist = v1[0],v1[1]
    #print(v1_d,v1_elist)
    for e in v1_elist:
        a,b,c = e
        v2 = vlist[b]
        v2_d, v2_elist = v2
        if v1_d == None:
            continue
        elif v3_d == None or v2_d > v1_d +c:
            vlist[b][0] = v1_d + c

g1 = vlist[g_loc][0]  

if g0 != g1:
    print('inf')
else:
    print(-g0)

#print('res',g0,g1)
for v in vlist:
    #print(v)        
    pass



### FIXED CODE ###

import sys

INF = float('inf')

def Bellmanford(n, edges, r): #r: 始点
    d = [INF] * n
    d[r] = 0
    
    for i in range(n):
        for (u, v, c) in edges:
            if d[u] != INF and d[u] + c < d[v]:
                d[v] = d[u] + c
                if i == n-1 and v == n-1:
                    return 'inf'
    
    return -d[n-1]
    

N, M = map(int, sys.stdin.readline().split())
Edges = [None] * M

for i in range(M):
    ai, bi, ci = map(int, sys.stdin.readline().split())
    Edges[i] = (ai-1, bi-1, -ci)
    
ans = Bellmanford(N, Edges, 0)

print(ans)
a = raw_input()
a.split(' ')
for i in range(a[0]):
    a = raw_input()
    print a
    print a

### FIXED CODE ###

a = raw_input()
if a == 'a' or a=='i' or a=='u' or a=='e' or a=='o':
    print 'vowel'
else:
    print 'consonant'
S=list(input())
N=len(S)
S_int=list(S)
for i in range(N):
    S_int[i]=int(S[i])
cnt_1=0
cnt_2=0
if all([S_int[i]!=S_int[i+1] for i in range(N)]):
    print(0)
for i in range(N):
    if i%2==0 and S_int[i]==0:
        S_int[i]=1
        cnt_1+=1
    elif i%2==1 and S_int[i]==1:
        S_int[i]=0
        cnt_1+=1
for i in range(N):
    if i%2==0 and S_int[i]==1:
        S_int[i]=0
        cnt_2+=1
    elif i%2==1 and S_int[i]==0:
        S_int[i]=1
        cnt_2+=1
print(min(cnt_1,cnt_2))

### FIXED CODE ###

S=list(input())
N=len(S)
S_int_1=list(S)
S_int_2=list(S)
for i in range(N):
    S_int_1[i]=int(S[i])
    S_int_2[i]=int(S[i])
cnt_1=0
cnt_2=0
for i in range(N):
    if i%2==0 and S_int_1[i]==0:
        S_int_1[i]=1
        cnt_1+=1
    elif i%2==1 and S_int_1[i]==1:
        S_int_1[i]=0
        cnt_1+=1
for i in range(N):
    if i%2==0 and S_int_2[i]==1:
        S_int_2[i]=0
        cnt_2+=1
    elif i%2==1 and S_int_2[i]==0:
        S_int_2[i]=1
        cnt_2+=1
print(min(cnt_1,cnt_2))
while True:
  n=int(input())
  if n%7==0:
    print('{}'.format('thu'))
  elif n%7==1:
    print('{}'.format('fri'))
  elif n%7==2:
    print('{}'.format('sat'))
  elif n%7==3:
    print('{}'.format('san'))
  elif n%7==4:
    print('{}'.format('mon'))
  elif n%7==5:
    print('{}'.format('tue'))  
  else:
    print('{}'.format('wed'))


### FIXED CODE ###

x=int(input())
week=["thu","fri","sat","sun","mon","tue","wed"]
print(week[x%7])
n = int(input())
a = [int, for i in input().split()]
b = [int, for i in input().split()]
c = 0

for i in range(n):
	if a[i] >= b[i]:
		c += b[i]
	else:
		c += a[i]
		c += min(a[i+1],b[i]-a[i])
		if a[i+1] >= b[i]-a[i]:
			a[i+1] = a[i+1] - (b[i] - a[i])
		else:
			a[i+1] = 0
print(c)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = 0
 
for i in range(n):
  if a[i] >= b[i]:
    c += b[i]
  else:
    c += a[i]
    c += min(a[i+1],b[i]-a[i])
    if a[i+1] >= b[i]-a[i]:
      a[i+1] = a[i+1] - (b[i] - a[i])
    else:
      a[i+1] = 0
     
print(c)
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N-1)
for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

### FIXED CODE ###

from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])
n=int(input())
a = list(map(int,input(). split ()))
if 0 in a:
    print(0)

prod = 1
for a in A:
    prod *= a
    if prod > 10**18:
        print(-1)

print(prod)


### FIXED CODE ###


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

    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)
    return

main ()
H = int(input())
s = 1
while H!=0:
    H = divmod(H, 2)[0]
    s *= 2
s = s / 2
print(int(s + p))


### FIXED CODE ###

H = int(input())
s = 1
while H!=0:
    H = divmod(H, 2)[0]
    s *= 2
s = s / 2
p = s - 1
print(int(s + p))
N, Q = map(int, input().split())

edge = [[] for i in range(N)]
ans = [0] * N
query = [0] * N

for i in range(N-1):
    a, b = map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

for q in range(Q):
    p, x = map(int, input().split())
    query[p-1] += x

is_visited = [False] * N

def dfs(cur, q):
    is_visited[cur] = True
    q = q + query[cur]
    ans[cur] += q

    for next in edge[cur]:
        if is_visited[next]:
            continue
        dfs(next, q)

dfs(0, 0)

print(*ans)

### FIXED CODE ###

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

edge = [[] for i in range(N)]
ans = [0] * N
query = [0] * N

for i in range(N-1):
    a, b = map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

for q in range(Q):
    p, x = map(int, input().split())
    query[p-1] += x

is_visited = [False] * N
stack = [(0,0)]

while len(stack) != 0:
    cur, q = stack.pop()
    is_visited[cur] = True

    q = q + query[cur]
    ans[cur] += q

    for next in edge[cur]:
        if is_visited[next]:
            continue
        stack.append((next, q))

print(*ans)
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
for j in range(n):
  print(max(max(a[:j]),max(a[j+1:])))

### FIXED CODE ###

import collections
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
b=collections.Counter(a)
d=list(b.items())
d.sort(key=lambda x:-int(x[0]))
if d[0][1]==1:
  for i in range(n):
    if a[i]==int(d[0][0]):
      print(int(d[1][0]))
    else:
      print(int(d[0][0]))
else:
  for i in range(n):
    print(int(d[0][0]))
n, k = map(int, input().split())
lst = sorted(list(map(int, input().split())))
mod = 10 ** 9 + 7

if lst[-1] < 0 or k % 2 == 1:
	ans1 = 1
	for i in range(k):
		ans1 *= lst[- i - 1] % mod
		ans %= mod
	print(ans1)
	exit()
	
ans2 = 1
l = 0
r = n - 1
if k % 2 == 1:
	ans2 = lst[-1]
	r -= 1
	
for i in range(k // 2):
	left = lst[l] * lst[l + 1]
	right = lst[r - 1] * lst[r]
	if left > right:
		ans2 *= left % mod
		ans2 %= mod
		l += 2
	else:
		ans2 *= right % mod
		ans2 %= mod
		r -= 2
		
print(ans2 % mod)

### FIXED CODE ###

n,k=map(int,input().split())
A=sorted(list(map(int,input().split())))


mod=10**9+7

if A[-1]<0 and k%2==1:
    now=1
    for i in range(k):
        now*=A[-i-1]%mod
        now%=mod
    print(now) ;exit()

l=0 ; r=n-1
ans=1
if k%2==1:
    ans=A[-1]
    r-=1

for i in range(k//2):
    mi=A[l]*A[l+1]
    pl=A[r]*A[r-1]
    if mi>pl:
        ans*= mi%mod
        ans%=mod
        l+=2
    else:
        ans*= pl%mod
        ans%=mod
        r-=2
print(ans%mod)
import math
a,b,c = map(int, input().split())

if c-b-a>0 and (c-a-b)**2-4ab>0 :
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import math
a,b,c = map(int, input().split())
x=a**2+b**2+c**2+2*a*b-2*b*c-2*a*c
y=4*a*b

if c-b-a>0 and x-y>0 :
    print("Yes")
else:
    print("No")
a,b,c,d=map(int,input().split())
for _ in range(100):
    a,c-=d,b
    if b<1:
        print("Yes")
        exit()
    if a<1:
        print("No")
        exit()

### FIXED CODE ###

a,b,c,d=map(int,input().split())
for _ in range(100):
    a-=d
    c-=b
    if c<1:
        print("Yes")
        exit()
    if a<1:
        print("No")
        exit()