Harryxun/stf_run huggingface dataset:
N, = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))[::-1]
z=zc=0
Z = []
for i in range(N):
    if X[i]==Y[i]:
        zc += 1
        z = Y[i]
    else:
        Z.append(Y[i])
if zc:
    Z = [z]*zc//2+Z+[z]*(zc+1)//2
for i in range(N):
    if X[i] == Z[i]:
        print("No")
        break
else:
    print("Yes")
    print(*Z)


### FIXED CODE ###

N, = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))[::-1]
on = []
z = 0
for i in range(N):
    if not X[i]-Y[i]:
        on.append(i)
        z = X[i]
for i in range(N):
    if X[i]!=z and Y[i] != z and on:
        j = on.pop()
        Y[i], Y[j] = Y[j], Y[i]
if on:
    print("No")
else:
    print("Yes")
    print(*Y)
n = input
ans - ''
for i in range(len(n)):
    if n[i] == '1':
        ans += '9'
    else :
        ans += '1'
print(ans)

### FIXED CODE ###

n = input()
ans = ''
for i in range(3):
    if n[i] == '1':
        ans += '9'
    else :
        ans += '1'
print(ans)
n, m = map(int, input().split())

left = [""] * (n - 2)
right = [""] * (n - 2)

for i in range(m):
    a, b = map(int, input().split())
    left[a - 1] = "["
    right[b - 2] = "]"

s = ""
for i in range(n):
    s += left[i]
    s += right[i]

count = 0
for i in range(len(s) - 1):
    if s[i:i+2] == "[]":
        count += 1
print(count)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, M = (int(i) for i in input().split())
dic = {}
cnt = 0
pos = 0
for i in range(M):
    a, b = map(int, input().split())
    if b not in dic or dic[b] < a:
        dic[b] = a

for j in sorted(dic.keys()):
    if dic[j] >= pos:
        cnt += 1
        pos = j
print(cnt)
N = int(input())
ans = 0

for i in range(N + 1):
  if i % 15 == 0:
    ai = FizzBuzz
  if i % 3 == 0 and i % 5 =! 0:
    ai = Fizz
  if i % 3 =! 0 and i % 5 == 0:
    ai = Buzz
  else:
    ai = i
  
  ans = ans + ai

print(ans)


### FIXED CODE ###

N = int(input())
ans = 0

for i in range(N + 1):
  if i % 3 == 0 or i % 5 == 0:
    ai = 0 
  else:
    ai = i
  
  ans = ans + ai

print(ans)
S = input()[::-1]
T = input()[::-1]
Flg = False

ans1 = "z"*len(S)
pos = ""
num = 0
for i in range(len(S)-len(T)+1):
    sl = ""
    sl = S[i:(i+len(T))]
    for j in range(len(T)):
        pos = ""
        if(sl[j] == T[j]):
            if(sl.count("?") >= len(T)-1):
                pos += S[:i]+T+S[(i+len(T)):]
                Flg = True
                if(pos < ans1):
                    ans1 = pos
if(Flg == True):
    ans1 = ans1.replace("?", "a")   
    print(ans)
else:
    print("UNRESTORABLE")

### FIXED CODE ###

S = input()
T = input()
Flg = False

ans1 = "z"*len(S)
pos = ""
num = 0
for i in range(len(S)-len(T)+1):
    sl = ""
    sl = S[i:(i+len(T))]
    for j in range(len(T)):
        pos = ""
        if(sl[j] != "?" and sl[j] != T[j]):
            break
    else:
        pos += S[:i]+T+S[(i+len(T)):]
        if(ans1 > pos):
            ans1 = pos
            Flg = True
                
if(Flg == True):
    ans1 = ans1.replace("?", "a") 
    print(ans1)
else:
    print("UNRESTORABLE")
from decimal import *
A,B,C,D=list(map(int,input_[0].split()))

def gcd(a,b):
    x=max(a,b)
    y=min(a,b)
    
    while True:
#         print(x,y)
        y_ = x % y
        if y_ == 0:
            return y
        x = y
        y = y_

def lcm(a,b):
    ans=Decimal(a*b)/Decimal(gcd(a,b))
    return ans.as_integer_ratio()[0]

CD=lcm(C,D)
len_all = B-A+1
len_c = B//C-(A-1)//C
len_d = B//D-(A-1)//D
len_c_and_d = B//CD-(A-1)//CD

ans=len_all-len_c-len_d+len_c_and_d 
print(int(ans))

### FIXED CODE ###

from decimal import *
A,B,C,D=list(map(int,input().split()))

def gcd(a,b):
    x=max(a,b)
    y=min(a,b)
    
    while True:
#         print(x,y)
        y_ = x % y
        if y_ == 0:
            return y
        x = y
        y = y_

def lcm(a,b):
    ans=Decimal(a*b)/Decimal(gcd(a,b))
    return ans.as_integer_ratio()[0]

CD=lcm(C,D)
len_all = B-A+1
len_c = B//C-(A-1)//C
len_d = B//D-(A-1)//D
len_c_and_d = B//CD-(A-1)//CD

ans=len_all-len_c-len_d+len_c_and_d 
print(int(ans))
S =　list(input())
if "7" in S:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

S =list(str(input()))
if "7" in S:
  print('Yes')
else:
  print('No')
s=eval(input()).replace(" ","+");print(s if s < 10 else"10")

### FIXED CODE ###

p = sum(map(int, input().split()))
if p < 10:
    print(p)
else:
    print("error")
S = input()
T = input()
count = 0
for i in [:len(S)]:
  if S[i] == T[i]:
    count += 1
print(count)

### FIXED CODE ###

S = input()
T = input()
count = 0
for i in range(len(S)):
  if S[i] != T[i]:
    count += 1
print(count)
table = [0] * 4*3*10

n = int(input())

for i in range(n):
    b,f,r,v = map(int, input().split())
    table[30(b-1)+10(f-1)+(r-1)] += v

for i in range(120)
    if i % 30:
        print("####################")
    print(table[i], end="")
    if i%10 ==9:
        print()
    else:
        print(" ", end="")



### FIXED CODE ###

#
# 6c
#


def main():
    A = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
    n = int(input())
    for i in range(n):
        b, f, r, v = map(int, input().split())
        A[b-1][f-1][r-1] += v
    for i in range(4):
        for j in range(3):
            print(" ", end="")
            print(*A[i][j])
        if i < 3:
            print("#" * 20)


if __name__ == '__main__':
    main()
import numpy as np
N=int(input())
A=np.zeros(N+1)
a=list(map(int,input().split()))
for i in range(N+1):
  A[i]=a[i]
v=0
j=0
k=0
B=np.zeros(N+1)
for i in range(N+1):
  B[i]=N-i
for i in reversed(range(0, N+1)):
  j+=A[i]/(2**i)
  if i==N:
    k=A[i]
  else:
    k=min(k+A[i],2**i-np.sum(A[0:i]*(2**(B[0:i]-(N-i)))))
  v+=k

if j>1:
  print(-1)
else:
  print(int(v))

### FIXED CODE ###

import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=np.sum(A)-np.cumsum(np.append(0, A[:len(A)-1]))
v=0
k=0
for i in range(N+1):
  if i==0:
    if N==0 and A[0]==1:
      k=1
    elif A[0]==0:
      k=1
    else:
      print(-1)
      break
  elif i==N:
    if B[i]<=2*(k-A[i-1]):
      k=B[i]
    else:
      k=0
      print(-1)
      break
  else:
    k=min(2*(k-A[i-1]),B[i])
    if k<=0:
      print(-1)
      break
  v+=k
if k>0:
  print(v)
a,b,n = map(int,input().split())

y = 0

for x in range(1,n+1):
    if x%b!=0:
        temp = ((a*x)//b) - a*(x//b)
    else:
        temp = 0
    if y < temp:
        y = temp
        ans = x
    
print(ans)

### FIXED CODE ###

a,b,n = map(int,input().split())
x=min(b-1,n)
print(((a*x)//b) - a*(x//b))
N,K = map(int, input().split())

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

sortp = sorted(p)

sum = sortp[0]+sortp[1]+sortp[2]

print(sum)

### FIXED CODE ###

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

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

sortp = sorted(p)
sum=0
for k in range(K):
    sum=sum+sortp[k]

print(sum)
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
sA = T1*A1+T2*A2
sB = T1*B1+T2*B2
if sA == sB:
  print("infinity")
hA = T1*A1
hB = T1*B1
if sA > sB:
  hA, sA, hB, sB = hB, sB, hA, sA
#print(hA, sA, hB, sB)
if hA < hB:
  print(0)
n = 2*((hA-hB)//(sB-sA))+1
print(n)


### FIXED CODE ###

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
sA = T1*A1+T2*A2
sB = T1*B1+T2*B2
if sA == sB:
  print("infinity")
  exit()
hA = T1*A1
hB = T1*B1
if sA > sB:
  hA, sA, hB, sB = hB, sB, hA, sA
#print(hA, sA, hB, sB)
if hA < hB:
  print(0)
  exit()
if (hA-hB)%(sB-sA) == 0:
  r = 2*((hA-hB)//(sB-sA))
else:
  r = 2*((hA-hB)//(sB-sA))+1
print(r)
N = int(input())
counter =-1 
number = 0
for i+1 in range(N):
    k = i
    now_counter = 0
    while(k % 2 == 0):
        now_counter += 1
        k /= 2
    if(now_counter > counter):
        number = i
print(number)


### FIXED CODE ###

N = int(input())
counter =-1 
number = 0
for i in range(N):
    k = i+1
    now_counter = 0
    while(k % 2 == 0):
        now_counter += 1
        k /= 2
    if(now_counter > counter):
        number = i+1
        counter = now_counter
print(number)
N = int(input().strip())

count = 0
while True:
    if (count + 1) ** 2 > N:
        print(count)
        break
    count += 1

### FIXED CODE ###

line1 = input().strip()
line2 = input().strip()

if line1[0] == line2[2] and line1[1] == line2[1] and line1[2] == line2[0]:
    print("YES")
else:
    print("NO")
from collections import Counter
from itertools import combinations, reduce

import operator

GOOD_LETTERS = "MARCH"
PEOPLE = 3

n = int(input())
c = Counter()

for _ in range(n):
  first = input()[0]
  if first in GOOD_LETTERS:
    c.update(first)
    
ways = 0
for tup in combinations(GOOD_LETTERS, PEOPLE):
  ways += reduce(operator.mul, [c[ch] for ch in tup], 1)

print(ways)

### FIXED CODE ###

from collections import Counter
from functools import reduce
from itertools import combinations

import operator

GOOD_LETTERS = "MARCH"
PEOPLE = 3

n = int(input())
c = Counter()

for _ in range(n):
  first = input()[0]
  if first in GOOD_LETTERS:
    c.update(first)

ways = 0
for tup in combinations(GOOD_LETTERS, PEOPLE):
  ways += reduce(operator.mul, [c[ch] for ch in tup], 1)

print(ways)
while True:
 w=float(input())
 if w<=48:
   judge='light fly'
 elif 48<=w<=51:
   judge='fly'
 elif 51<=w<=54:
   judge='bantam'
 elif 54<=w<=57:
   judge='feather'
 elif 57<=w<=60:
   judge='light'
 elif 60<=w<=64:
   judge='light welter'
 elif 64<=w<=69:
   judge='welter'
 elif 69<=w<=75:
   judge='light middle'
 elif 75<=w<=81:
   judge='middle'
 elif 81<=w<=91:
   judge='light heavy'
 elif w>=91:
   judge='heavy'  

 print(judge)

### FIXED CODE ###

while True:
  try:
   w=float(input())
   if w<=48:
    judge='light fly'
   elif 48<=w<=51:
    judge='fly'
   elif 51<=w<=54:
    judge='bantam'
   elif 54<=w<=57:
    judge='feather'
   elif 57<=w<=60:
    judge='light'
   elif 60<=w<=64:
    judge='light welter'
   elif 64<=w<=69:
    judge='welter'
   elif 69<=w<=75:
    judge='light middle'
   elif 75<=w<=81:
    judge='middle'
   elif 81<=w<=91:
    judge='light heavy'
   else:
    judge='heavy'  
   print(judge)
  except EOFError:
   break
N = input()

if N = N[::-1]:
  r = 'Yes'
else:
  r = 'No'

print(r)

### FIXED CODE ###

N = input()

rN = N[::-1]
if N == rN:
  r = 'Yes'
else:
  r = 'No'
 
print(r)
import numpy as np

# not solved by myself
N = input()
A = list(map(int, input().split()))

Sum = sum(A)
s = []
multi = 1
for t in A:
    multi = np.lcm(multi, t)

for a in A:
    s.append(int(multi / a))

print(multi / sum(s))


### FIXED CODE ###

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

print(1 / sum(1 / x for x in A))
N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit()
if max(A) < K or N == 1:
    print("IMPOSSIBLE")
    exit()

A.sort()
for i in range(1, N):
    tmp = abs(A[i - 1] - A[i])
    if K % tmp == 0:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit()
if max(A) < K or N == 1:
    print("IMPOSSIBLE")
    exit()

A.sort()
for i in range(1, N):
    tmp = abs(A[i - 1] - A[i])
    if not tmp == 0 and K % tmp == 0:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")
a,x=map(int,input().split())
print(10 if A>=X else 10)

### FIXED CODE ###

A,X=map(int,input().split())
print(10 if A>=X else 0)
N, M = map(int, input().split())

A = sorted(list(map(int, input().split())), reverse=True)

B = []
for i in range(M):
    b, c = map(int, input().split())
    B.append([b, c])

B.sort(key=lambda x:(-x[1]))

cnt = 0
ans = 0
a = 0
b = 0
while True:
    if b <= M-1 and A[a] <= B[b][1]:
        for k in range(B[b][0]):
            ans += B[b][1]
            cnt += 1
            if cnt == N:
                print(ans)
                break
        b += 1
    else:
        cnt += 1
        ans += A[a]
        if cnt == N:
            print(ans)
            break
        a += 1

### FIXED CODE ###

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

A = sorted(list(map(int, input().split())), reverse=True)

B = []
for i in range(M):
    b, c = map(int, input().split())
    B.append([b, c])

B.sort(key=lambda x:(-x[1]))

cnt = 0
ans = 0
a = 0
b = 0
while True:
    if b <= M-1 and A[a] <= B[b][1]:
        n = min(B[b][0], N-cnt)
        ans += B[b][1]*n
        cnt += n
        if cnt == N:
            print(ans)
            break
        b += 1
    elif a <= N-1:
        cnt += 1
        ans += A[a]
        if cnt == N:
            print(ans)
            break
        a += 1
A = [list(map(int,input().split())) for i in range(3)]
A_flat=[]
for i in range(len(A)):
    A_flat.append(A[i][0])
    A_flat.append(A[i][1])
    A_flat.append(A[i][2])

N = int(input())
b = [int(input()) for i in range(N)]
for i in range(len(b)):
    if b[i] in A_flat:
        index = A_flat.index(b[i])
        A_flat[index] = 0

 judge=False
for i in range(3):
    if A_flat[0+i] == A_flat[3+i] == A_flat[6+i]:
        print("Yes")
        judge = True
        break
    elif A_flat[0+i*3]==A_flat[1+i*3]==A_flat[2+i*3]:
        print("Yes")
        judge = True
        break
    elif A_flat[0]==A_flat[4]==A_flat[8] or A_flat[2]==A_flat[4]==A_flat[6]:
        print("Yes")
        judge = True
        break

if judge is False:
    print("No")


### FIXED CODE ###

A = [list(map(int,input().split())) for i in range(3)]
A_flat=[]
for i in range(len(A)):
    A_flat.append(A[i][0])
    A_flat.append(A[i][1])
    A_flat.append(A[i][2])

N = int(input())
b = [int(input()) for i in range(N)]
for i in range(len(b)):
    if b[i] in A_flat:
        index = A_flat.index(b[i])
        A_flat[index] = 0

judge=False
for i in range(3):
    if A_flat[0+i] == A_flat[3+i] == A_flat[6+i]:
        print("Yes")
        judge = True
        break
    elif A_flat[0+i*3]==A_flat[1+i*3]==A_flat[2+i*3]:
        print("Yes")
        judge = True
        break
    elif A_flat[0]==A_flat[4]==A_flat[8] or A_flat[2]==A_flat[4]==A_flat[6]:
        print("Yes")
        judge = True
        break

if judge is False:
    print("No")
n=int(input())
v=[int(i) for i in input().split()]
v.sort()
mid=(v[0]+v[1])/2
for i in v[2,n]:
  mid=(mid+v[i])/2
print(mid)

### FIXED CODE ###

n=int(input())
v=[int(i) for i in input().split()]
v.sort()
mid=(v[0]+v[1])/2
for i in range(2,n):
  mid=(mid+v[i])/2
print(mid)
S, W = map(int,input().split())
print("safe"if S>W"unsafe"else)


### FIXED CODE ###

S, W = map(int,input().split())
print("safe"if S>W else"unsafe")
X = int(input())
A = [i for i in range(0, 100)]
B = [-i for i in range(0, 100)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(B)):
    b = B[j]
    cal = a ** 5 - b ** 5
    if cal == X:
      res.append([a, b])
print(' '.join(map(str, res[0])))

### FIXED CODE ###

X = int(input())
A = [(i**5) for i in range(0, 1000)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(A)):
    b = -A[j]
    cal = a - b
    cal2 = a + b
    if cal == X:
      print(i, -j)
      exit()
    elif cal2 == X:
      print(i, j)
      exit()
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    XY=[tuple(map(int,input().split())) for _ in range(n)]
    parity=[0]*2
    for x,y in XY:
        parity[(x+y)%2]=1

    # 双方のparityがあれば不可能
    if(parity[0] and parity[1]):
        print(-1)
        return

    # for output
    m=31
    D=[pow(2,i) for i in range(m)]
    W=[0]*m
    # parityが偶数ならば、先に長さ1のRを入れることで、奇数の場合に帰着
    if(parity[0]):
        XY=[(x-1,y) for x,y in XY]
        D=[1]+D

    # 45 deg 回転
    U=[x-y for x,y in XY]
    V=[x+y for x,y in XY]

    for j in range(n): # 各 U[i],V[i]に対して方向を定める
        res=[0]*m
        u=(U[j]+pow(2,m)-1)//2
        v=(V[j]+pow(2,m)-1)//2
        for i in range(m):
            ub=u&1; vb=v&1
            if(ub and vb):
                res[i]='R'
            elif(ub and (not vb)):
                res[i]='D'
            elif((not ub) and vb):
                res[i]='U'
            else:
                res[i]='L'
            u>>=1; v>>=1
        W[j]=''.join(res)

    # output
    print(m+parity[0])
    print(*D)
    for j in range(n):
        ans=W[j] if(parity[1]) else 'R'+W[j]
        print(ans)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    XY=[tuple(map(int,input().split())) for _ in range(n)]
    parity=[0]*2
    for x,y in XY:
        parity[(x+y)%2]=1

    # それぞれのパリティの点が存在すると不可能
    if(parity[0] and parity[1]):
        print(-1)
        return

    m=31
    D=[pow(2,i) for i in range(m)]
    # 偶数の場合は奇数に帰着させる
    if(parity[0]):
        XY=[(x-1,y) for x,y in XY]
        D=[1]+D

    U=[x-y for x,y in XY]
    V=[x+y for x,y in XY]

    W=[0]*n
    for j in range(n):
        res=[0]*m
        u=(U[j]+pow(2,m)-1)//2
        v=(V[j]+pow(2,m)-1)//2
        for i in range(m):
            ub=u&1; vb=v&1
            if(ub and vb):
                res[i]='R'
            elif(ub and (not vb)):
                res[i]='D'
            elif((not ub) and vb):
                res[i]='U'
            else:
                res[i]='L'
            u>>=1; v>>=1
        ans=''.join(res)
        W[j]=ans

    m=m+parity[0]
    print(m)
    print(*D)
    for j in range(n):
        ans=W[j] if(parity[1]) else 'R'+W[j]
        print(ans)
resolve()
#!/usr/bin/env python3
import sys
INF = float("inf")


def yes():
    print("YES")  # type: str


def no():
    print("NO")  # type: str


template = ["dream", "dreamer", "erase", "eraser"]


def dfs(s):
    if len(s) == 0:
        return True
    for t in template:
        if s.startswith(t):
            if dfs(s[len(t):]):
                return True
    return False


def solve(S: str):
    if dfs(S):
        yes()
    else:
        no()

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
INF = float("inf")

sys.setrecursionlimit(10**5)


def yes():
    print("YES")  # type: str


def no():
    print("NO")  # type: str


template = ["dream", "dreamer", "erase", "eraser"]


def dfs(s, i):
    if i == len(s):
        return True
    for t in template:
        if s[i:].startswith(t):
            if dfs(s, i+len(t)):
                return True
    return False


def solve(S: str):
    if dfs(S, 0):
        yes()
    else:
        no()

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()
if k * 500 >= x:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

k,x = map(int, input().split())
if k * 500 >= x:
  print("Yes")
else:
  print("No")
N=input()
a=list(map(int,input().split()))
c=0
T=True
for i in a:
    if (i%2)!=0:
        print(c)
        break
    else:
        while T:
            a=list(map(lambda x:x/2,a))
            c+=1
            b=list(map(lambda x:True if x%2==0 else False,a))
            T=b[False]
        print(c)

### FIXED CODE ###

print(input().count("1"))
import sys
input = sys.stdin.readline
from collections import *

N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10**9+7
p, n = [], []
flag = False

for Ai in A:
    if Ai==0:
        flag = True
    elif Ai>0:
        p.append(Ai)
    else:
        n.append(Ai)

if len(p)==0 and K%2==1:
    if 0 in A:
        print(0)
    else:
        n.sort(reverse=True)
        ans = 1
        
        for ni in n[:K]:
            ans *= ni
            ans %= MOD
        
        print(ans)
    exit()
    
if K==N:
    ans = 1
    
    for Ai in A:
        ans *= Ai
        ans %= MOD
    
    print(ans)
    exit()

p.sort(reverse=True)
n.sort()

if K%2==0:
    l = []
    
    for i in range(len(p)//2):
        l.append(p[2*i]*p[2*i+1])
    
    for i in range(len(n)//2):
        l.append(n[2*i]*n[2*i+1])

    l.sort(key=lambda x: abs(x), reverse=True)
    ans = 1
    
    for i in range(K//2):
        ans *= l[i]
        ans %= MOD
else:
    ans = p[0]
    l = []
    
    for i in range(len(p)//2):
        l.append(p[2*i]*p[2*i+1])
    
    for i in range(len(n)//2):
        l.append(n[2*i]*n[2*i+1])
    
    l.sort(key=lambda x: abs(x), reverse=True)
    
    for i in range(K//2):
        ans *= l[i]
        ans %= MOD

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10**9+7
p, n = [], []

for i in range(N):
    if A[i]>=0:
        p.append(A[i])
    else:
        n.append(A[i])

ok = False

if len(p)>0:
    if N==K:
        if len(n)%2==0:
            ok = True
    else:
        ok = True
else:
    if K%2==0:
        ok = True

if not ok:
    A.sort(key=lambda x: abs(x))
    ans = 1
    
    for Ai in A[:K]:
        ans *= Ai
        ans %= MOD

    print(ans)
    exit()

p.sort(reverse=True)
n.sort()

if K%2==1:
    ans = p[0]
    p = p[1:]
else:
    ans = 1
    
l = []
    
for i in range(len(p)//2):
    l.append(p[2*i]*p[2*i+1])
    
for i in range(len(n)//2):
    l.append(n[2*i]*n[2*i+1])

l.sort(key=lambda x: abs(x), reverse=True)

for li in l[:K//2]:
    ans *= li
    ans %= MOD
    
print(ans)
import numpy as np
T,X = map(int, input().split())
print(T/x*1.00000)

### FIXED CODE ###

import numpy as np
T,X = map(int, input().split())
print(T/X*1.00000)
l = []
for i in range(6):
   l.append(int(input()))
   print(i,l)

if l[0]-l[1]>l[5] or l[1]-l[2]>l[5] or l[2]-l[3]>l[5] or l[3]-l[4]>l[5] or:
    no()
else:
    yes()


### FIXED CODE ###

l = []
for i in range(6):
   l.append(int(input()))

if l[4]-l[0]>l[5]:
    print(":(")
else:
    print("Yay!")
L = input()
x = int(L/3)
print(x**3)

### FIXED CODE ###

L = int(input())
x = float(L/3)
print(x**3)
import sys
M = 1001; p = [1]*M;
p[0],p[1] = 0,0
for i in xrange(31):
    if p[i]:
        for j in xrange(i*i,M,i):
            p[j] = 0
for s in sys.stdin.readlines():
    n = int(s); ans = 0;
    for i in xrange(1,n+1):
        if p[i] and p[n+1-i]:
            ans += 1
    print ans

### FIXED CODE ###

M = 10001; p = [1]*M;
p[0],p[1] = 0,0
for i in xrange(2,101):
    if p[i]:
        for j in xrange(i*i,M,i):
            p[j] = 0
while 1:
    try:
        n = int(raw_input()); ans = 0;
        for i in xrange(1,n+1):
            if p[i] and p[n+1-i]:
                ans += 1
        print ans
    except EOFError:
        break
N = int(input())
A = [int(i) for i in input().split()]
en = 0
con = True
while con :
	en += 1
	for i in range(N) :
		if A[i] % 2 == 0 :
			A[i] = int( A[i] / 2 ) 
		else :
			en -= 1
			con = False
			break
print(en)

### FIXED CODE ###

num = 0
s = input()
for i in s:
  if int(i) == 1:
    num += 1
print(num)