Harryxun/stf_run huggingface dataset:
from math import log2

N, K = map(int, input().split())
A = [int(i) for i in input().split()]

mod = 10 ** 9 + 7

p = []
m = []
for a in A :
  if a > 0 :
    p.append(a)
  else :
    m.append(-a)
    
p.sort(reverse=True)
m.sort(reverse=True)
pl = [0]
ml = [0]

for i in range(len(p)) :
  pl.append(log2(p[i]))
for i in range(len(m)) :
  ml.append(log2(m[i]))
for i in range(1, len(pl)) :
  pl[i] += pl[i - 1]
for i in range(1, len(ml)) :
  ml[i] += ml[i - 1]

Mi = -1
Mv = 0
for i in range(0, len(ml), 2) :
  j = K - i
  if len(pl) <= j or j < 0 : continue
  if ml[i] + pl[j] > Mv :
    Mi, Mv = i, ml[i] + pl[j]

if Mi != -1 :
  ret = 1
  for i in range(K - Mi) :
    ret *= p[i]
    ret %= mod
  for i in range(Mi) :
    ret *= m[i]
    ret %= mod
else :
  x = [abs(a) for a in A]
  x.sort()
  ret = 1
  for i in range(K) :
    ret *= x[i]
    ret %= mod
  ret = -ret % mod
  
print(ret)

### FIXED CODE ###

from math import log10 as log2

N, K = map(int, input().split())
A = [int(i) for i in input().split()]

mod = 10 ** 9 + 7

p = []
m = []
for a in A :
  if a > 0 :
    p.append(a)
  elif a < 0 :
    m.append(-a)
    
p.sort(reverse=True)
m.sort(reverse=True)
pl = [0]
ml = [0]

for i in range(len(p)) :
  pl.append(log2(p[i]))
for i in range(len(m)) :
  ml.append(log2(m[i]))
for i in range(1, len(pl)) :
  pl[i] += pl[i - 1]
for i in range(1, len(ml)) :
  ml[i] += ml[i - 1]

Mi = -1
Mv = 0
for i in range(0, len(ml), 2) :
  j = K - i
  if len(pl) <= j or j < 0 : continue
  if ml[i] + pl[j] > Mv :
    Mi, Mv = i, ml[i] + pl[j]

if Mi != -1 :
  ret = 1
  for i in range(K - Mi) :
    ret *= p[i]
    ret %= mod
  for i in range(Mi) :
    ret *= m[i]
    ret %= mod
else :
  x = [abs(a) for a in A]
  x.sort()
  ret = 1
  for i in range(K) :
    ret *= x[i]
    ret %= mod
  ret = -ret % mod
  
print(ret)
S = input()

a = input()

T = S + a

if T - a = S:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

S = input()

T = input()

x = T[0:-1]

if S == x:
    print('Yes')
else:
    print('No')
A=int() , B=int()
x=A*B
if x%2==0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

A,B=list(map(int,input().split()))
x=A*B
if x%2==0:
  print('No')
else:
  print('Yes')
import numpy as np
import math
a,b,c,d = map(int, input().split())

cs = math.ceil(a / c)
ds = math.ceil(a / d)

w = np.zeros((b + 1))

x = int(c * cs)
while x <= b:
    w[x] = 1
    x += c

y = int(d * ds)
while y <= b:
    w[y] = 1
    y += d

print(int(len(w) - a - w.sum()))

### FIXED CODE ###

a,b,c,d = map(int, input().split())
def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y%x, x)
def lcm(x,y):
    return x * y // gcd(x,y)
l = lcm(c,d)
ans_b = b - b//c - b//d + b//l
ans_a = (a-1) - (a-1)//c - (a-1)//d + (a-1)//l
print(ans_b - ans_a)
import sympy
def mips():
    return map(int,input().split())
def ii():
    return int(input())
Q = ii()
S = [0 for i in range(10 ** 5 + 1)]
N = 0
for i in [j for j in range(1,10 ** 5 + 1)]:
    if sympy.isprime(i) and sympy.isprime((i+1)//2):
        N += 1
        S[i] = N
    else:
        S[i] = N
for i in range(Q):
    l,r = mips()
    print(S[r]-S[l-1])

### FIXED CODE ###

def mips():
    return map(int,input().split())
def ii():
    return int(input())
def is_prime(n):
    if n == 1:
        return False
    i = 2
    while i*i <= n: #sqrt(n)までで十分。
        if n % i == 0:
            return False
        i += 1
    return True
Q = ii()
S = [0 for i in range(10 ** 5 + 1)]
N = 0
for i in [j for j in range(1,10 ** 5 + 1)]:
    if is_prime(i) and is_prime((i+1)//2):
        N += 1
        S[i] = N
    else:
        S[i] = N
for i in range(Q):
    l,r = mips()
    print(S[r]-S[l-1])
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    for x,y,h in a:
        if h >0:
            this_sum.append(max(h + abs(x-X) + abs(y-Y)), 0)
    if all([i == this_sum[0] for i in this_sum]):
        H0 = this_sum[0]
        print(" ".join(list(map(str, [X, Y, H0]))))
        break

### FIXED CODE ###

n = int(input())
xyh = [[int(i) for i in input().split()] for j in range(n)]
xyh.sort(key=lambda x: x[2], reverse=True)

for i in range(101):
    for j in range(101):
        h = xyh[0][2] + abs(xyh[0][0] - i) + abs(xyh[0][1] - j)
        for k in xyh:
            if k[2] == max(h - abs(k[0] - i) - abs(k[1] - j), 0):
                continue
            else:
                break
        else:
            print(i, j, h)
from scipy.special import comb
n = int(input())
l = list(int(i) for i in input().split())

cnt = 0

for bars in comb(l, 3, exact=True):
    a, b, c = bars[0], bars[1], bars[2]
    if a < b + c and b < a + c and c < b + a:
        cnt += 1

print(cnt)


### FIXED CODE ###

import bisect


def main():
    n = int(input())
    l = sorted(list(int(i) for i in input().split()))

    cnt = 0

    for i in range(n - 2):
        a = l[i]
        for j in range(i + 1, n-1):
            b = l[j]
            cnt += bisect.bisect_left(l, a+b)-(j+1)

    print(cnt)


if __name__ == "__main__":
    main()
import sys
a=list(map(float,sys.stdin.readline()))
print(max(a)-min(a))


### FIXED CODE ###

x = []
while 1:
    try:
        h = float(input())
        x.append(h)
    except EOFError:
        break
print(max(x)-min(x))
N,K = map(int,input().split())
import math
A = list(map(int,input().split()))
flag = 0
if 0 in A:
    flag = 1
A.sort()
plus = list(filter(lambda x:x>0, A))[::-1]
plus = list(map(lambda x:math.log(x),plus ))

acc_plu = []
tmp = 0
for x in plus:
    acc_plu.append(tmp)
    tmp = math.fsum([tmp,x])

minu = filter(lambda x:x<0, A)
minu = list(map(lambda x:math.log(-x),minu))
acc_min = [] 
tmp = 0
for x in plus:
    acc_min.append(tmp)
    tmp = math.fsum([tmp,x])


if K % 2 == 0 : num = K // 2 + 1
else: num = (K + 1) // 2 
cand = []
x = K
y = 0
MOD = 10**9 +7
for i in range(num):
    try:
        cand.append((acc_plu[x] +  acc_min[y],x ,y ))
    except: pass
    x -= 2 
    y += 2


ans = 1
if cand == []:
    if flag:
        print(0)
        exit()
    cnt = 0
    minu = list(filter(lambda x:x<0, A))
    for x in minu[::-1]:
        if cnt == K:break
        ans *= x
        ans %= MOD
        cnt += 1
    print(ans)
else:
    cand = sorted(cand)[::-1]
    plus = list(filter(lambda x:x>0, A))[::-1]
    minu = list(filter(lambda x:x<0, A))
    c = cand[0]
    for i in range(c[1]):
        ans *= plus[i]
        ans %= MOD
    for i in range(c[2]):
        ans *= minu[i]
        ans %= MOD



### FIXED CODE ###

import numpy as np
N,K = map(int,input().split())
import math
A = list(map(int,input().split()))
flag = 0
if 0 in A:
    flag = 1
A.sort()

plus = list(filter(lambda x:x>0, A))[::-1]
plus = list(map(lambda x:np.longdouble(math.log(x,10000000)),plus))
from itertools import accumulate
acc_plu = [0] +  list(accumulate(plus))
minu = filter(lambda x:x<0, A)
minu = list(map(lambda x:np.longdouble(math.log(-x,10000000)),minu))
acc_min = [0] +  list(accumulate(minu))


if K % 2 == 0 : num = K // 2 + 1
else: num = (K + 1) // 2 
cand = []
x = K
y = 0
MOD = 10**9 +7
for i in range(num):
    try:
        cand.append((acc_plu[x] +  acc_min[y],x ,y ))
    except: pass
    x -= 2 
    y += 2

ans = 1
if cand == []:
    if flag:
        print(0)
        exit()
    cnt = 0
    #マイナス確定
    abss = sorted(list(map(lambda x :abs(x),A)))
    for x in abss:
        if cnt == K:break
        ans *= x
        ans %= MOD
        cnt += 1
    ans *= -1
    ans %= MOD
    print(ans)
else:
    cand = sorted(cand)[::-1]
    plus = list(filter(lambda x:x>0, A))[::-1]
    minu = list(filter(lambda x:x<0, A))
    c = cand[0]
    ans = 1
    for i in range(c[1]):
        ans *= plus[i]
        ans %= MOD
    for i in range(c[2]):
        ans *= minu[i]
        ans %= MOD
    print(ans)
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [0] * N
default = 99999
def rec(i):
  global dp
  if i == 0:
    return 0
  if dp[i] != 0:
    return dp[i]
  res = default
  res = min(res, rec(i-1) + np.abs(h[i] - h[i-1]))
  if i > 1:
    res = min(res, rec(i-2) + np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
print(rec(N-1))

### FIXED CODE ###

import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(key=lambda x:-x)
b.sort(key=lambda x:-x)
c.sort(key=lambda x:-x)
# queue=[beauty, indexa, indexb, indexc]
queue=[(a[0]+b[0]+c[0],0,0,0)]
beauty=[0 for _ in range(k)]
index=0
indexq=0
while index<k:
    queue.sort(key=lambda x:-x[0])
    # print(queue)
    beauty[index],indexa,indexb,indexc=queue[indexq]
    index+=1
    indexq+=1
    for da,db,dc in [(1,0,0),(0,1,0),(0,0,1)]:
        # print(indexa+da,indexb+db,indexc+dc)
        if indexa+da<x and indexb+db<y and indexc+dc<z:
            queue.append((a[indexa+da]+b[indexb+db]+c[indexc+dc],indexa+da,indexb+db,indexc+dc))
    queue=list(set(queue))
for i in range(k):
    print(beauty[i])


### FIXED CODE ###


x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(key=lambda x:-x)
b.sort(key=lambda x:-x)
c.sort(key=lambda x:-x)
beauty=[]
index=0
for i in range(x):
    for j in range(y):
        for l in range(z):
            if (i+1)*(j+1)*(l+1)<=k:
                beauty.append(a[i]+b[j]+c[l])
            else:
                break
beauty.sort(key=lambda x:-x)
for i in range(k):
    print(beauty[i])
N = int(input())
A = list(map(int, input().split()))

while 0 in A:
    A.remove(0)

A_ = list(set(A))
A_.sort()
for i in range(len(A_) - 1):
    if A_[i+1] == A_[i]+2:
        judge = 1
    else:
        judge = 0

if len(set(A)) == len(A)/2 and judge:
    print((2 ** (len(A) // 2)) % (10**9 +7))
else:
    print(0)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
judge = 1
while 0 in A:
    A.remove(0)

A_ = list(set(A))
A_.sort()
for i in range(len(A_) - 1):
    if A_[i+1] == A_[i]+2:
        judge = 1
    else:
        judge = 0

if len(set(A)) == len(A)/2 and judge:
    print((2 ** (len(A) // 2)) % (10**9 +7))
else:
    print(0)
a = int(input())
b = int(input())

if a == 1:
  if b == 2:
    print(3)
  else:
    print(2)

if a == 2:
  if b == 1:
    print(3)
  else:
    print(1)

if a == 3:
  if b == 1:
    print(2)
  else:
    printj(1)

### FIXED CODE ###

a = int(input())
b = int(input())

if a == 1:
  if b == 2:
    print(3)
  else:
    print(2)

if a == 2:
  if b == 1:
    print(3)
  else:
    print(1)

if a == 3:
  if b == 1:
    print(2)
  else:
    print(1)
n, m = [int(i) for i in input().split(' ')]
c_list = []
for i in range(m):
    c_list.append([int(i) for i in input().split(' ')])
number = [-1 for i in range(n)]
for line in c_list:
    if number[line[0] - 1] == -1:
        number[line[0] - 1] = line[1]
    else:
        if number[line[0] - 1] == line[1]:
            continue
        else:
            print("-1")
            break
else:
    if number[0] == 0 and len(number) != 1:
        print("-1")
    else:
        for i, index in enumrator(number):
            if index == -1:
                if i == 0:
                    index = 1
                else:
                    index = 0
            print(index, end="")

### FIXED CODE ###

n, m = [int(i) for i in input().split(' ')]
c_list = []
for i in range(m):
    c_list.append([int(i) for i in input().split(' ')])
number = [-1 for i in range(n)]
for line in c_list:
    if number[line[0] - 1] == -1:
        number[line[0] - 1] = line[1]
    else:
        if number[line[0] - 1] == line[1]:
            continue
        else:
            print("-1")
            break
else:
    if number[0] == 0:
        if len(number) != 1:
            print("-1")
        else:
            print("0")
    else:
        for i, index in enumerate(number):
            if index == -1:
                if i == 0 and len(number) != 1:
                    index = 1
                else:
                    index = 0
            print(index, end="")
import numpy as np

def solve():
    n = int(input())
    val = []
    for i in range(min(n, 3)):
        x, y, h = map(int, input().split())
        val.append([x+y+h, -x+y+h, x-y+h, -x-y+h])
    base = [[1, 1, 1], [1, -1, 1], [1, 1, -1], [1, -1, -1]]
    ans = []
    for i, xx in enumerate(base):
        for j, yy in enumerate(base):
            for k, zz in enumerate(base):
                A = np.array([xx, yy, zz])
                Y = np.array([[val[0][i]], [val[1][j]], [val[2][k]]])
                try:
                    AA = np.linalg.inv(A)
                except np.linalg.LinAlgError as e:
                    if 'Singular matrix' in str(e):
                        continue
                    else:
                        raise
                ans.append(np.dot(AA, Y).tolist())
    print(int(*ans[5][1]), int(*ans[5][2]), int(*ans[5][0]))

solve()


### FIXED CODE ###

def solve():
    n = int(input())
    X, Y, H = [], [], []
    for i in range(n):
        x, y, h = map(int, input().split())
        X.append(x), Y.append(y), H.append(h)

    for cx in range(101):
        for cy in range(101):
            res = []
            for x, y, h in zip(X, Y, H):
                if h == 0:
                    continue
                hh = h + abs(x - cx) + abs(y - cy)
                res.append(hh)
            if len(set(res)) == 1:
                flg = True
                for x, y, h in zip(X, Y, H):
                    if h != max(res[0] - abs(x - cx) - abs(y - cy), 0):
                        flg = False
                if flg:
                    print(cx, cy, res[0])

solve()
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k):
  if l[i] <0 and l[i+k-1]<=0:
    ls.append(abs(l[i]))
  elif l[i] >=0 and l[i+k-1]>0:
    ls.append(abs(l[i+k-1]))
  elif l[i] <0 and l[i+k-1]>0:
    ls.append(2*min(abs(l[i]),l[i+k-1]) + max(abs(l[i]),l[i+k-1]))
print(min(ls))

### FIXED CODE ###

n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))
n = int(input())
dat = list(map(int, input().split()))
dat_d = []

total = 0
for i in range( n):
    total += (dat[i] - (i+1))
    dat_d.append(dat[i] - (i+1))

#print(dat)
#print(dat_d)
#print(total)
#f = (total // n)
#print(f)

f = (dat_d[n//2])
dat_d = list(map(lambda x: x - f, dat_d))
total = 0
for i in range(n):
    total += abs(dat_d[i])

f = (dat_d[n//2 + 1])
dat_d = list(map(lambda x: x - f, dat_d))
total2 = 0
for i in range(n):
    total2 += abs(dat_d[i])

total = min(total, total2)

print(total)

### FIXED CODE ###

n = int(input())
dat = list(map(int, input().split()))
dat_d = []

total = 0
for i in range( n):
    total += (dat[i] - (i+1))
    dat_d.append(dat[i] - (i+1))

#print(dat)
#print(dat_d)
#print(total)
#f = (total // n)
#print(f)

dat_d.sort()
#print(dat_d)
f = dat_d[n//2]

total = 0
for i in range( n):
    total += abs(dat_d[i] - f)

print(total)
s = list(map(int, input().split()))
num = list(map(int, input().split()))
ALL = {}
for i in range(len(s)):
  ALL[s[i]] = num[i]

k = input()
ALL[k] -= 1
 
for i in range(len(s)):
  print(ALL[s[i]], end = ' ')

### FIXED CODE ###

s = list(map(str, input().split()))
num = list(map(int, input().split()))
ALL = {}
for i in range(len(s)):
  ALL[s[i]] = num[i]
 
ALL[input()] -= 1
 
for i in range(len(s)):
  print(ALL[s[i]], end = ' ')
import sys

def print_arr(arr):
	for i in range(len(arr)):
		sys.stdout.write(str(arr[i]))
		if i != len(arr) - 1:
			sys.stdout.write(' ')
	print()

def insertion_sort(arr, n, g):
	cnt = 0
	for i in range(g, n):
		v = arr[i]
		j = i - g
		while j >= 0 and arr[j] > v:
			arr[j + g] = arr[j]
			j = j - g
			cnt += 1
		arr[j + g] = v
	return cnt

def shell_sort(arr, g):
	cnt = 0
	for i in range(len(g)):
		cnt += insertion_sort(arr, len(arr), g[i])
	return cnt

def get_gap(n):
	lst = []
	v = 1
	while v <= n:
		lst.append(v)
		v += 3**cnt
	if len(lst) == 0: lst.append(1)
	return list(reversed(lst))

n = int(input())
arr = [0] * n
for i in range(n):
	arr[i] = int(input())

g = get_gap(n)
m = len(g)
cnt = shell_sort(arr, g)

print(m)
print_arr(g)
print(cnt)
for i in range(n):
	print(arr[i])



### FIXED CODE ###

import sys

def print_arr(arr):
	for i in range(len(arr)):
		sys.stdout.write(str(arr[i]))
		if i != len(arr) - 1:
			sys.stdout.write(' ')
	print()

def insertion_sort(arr, g):
	n = len(arr)
	cnt = 0
	for i in range(n):
		key = arr[i]
		j = i - g
		while j >= 0 and arr[j] > key:
			arr[j + g] = arr[j]
			j -= g
			cnt += 1
		arr[j + g] = key
	return cnt

def shell_sort(arr, G):
	cnt = 0
	for i in range(len(G)):
		cnt += insertion_sort(arr, G[i])
	return cnt

def get_gaps(n):
	lst = []
	v = 1
	cnt = 1
	while v <= n:
		lst.append(v)
		v += 3**cnt
		cnt += 1
	if len(lst) == 0: lst.append(1)
	return list(reversed(lst))

n = int(input())
arr = [None] * n
for i in range(n):
	arr[i] = int(input())

G = get_gaps(n)
cnt = shell_sort(arr, G)

print(len(G))
print_arr(G)
print(cnt)
for i in range(n):
	print(arr[i])
import sys
import math
sys.setrecursionlimit(1000000)
class Node:
    def __init__(self):
        self.next=[]
    def get_data(self,new_next,weight=1):
        self.next.append(new_next)
def BFS(i,depth,K):  
    depth+=1
    tmp=i
    seki=1
    num=len(tmp)
    if depth==1:
        calc=K-1
        diff=0
        #for i in range(calc,max(1,calc-(len(tmp)-diff)),-1):
        #seki*=special.perm(calc,num-diff)
        #for i in range(calc,calc-(num-diff),-1):
        #    seki*=i%1000000007
        
    else:
        calc=K-2
        diff=1
        #for i in range(calc,calc-(num-diff),-1):
        #    seki*=i%1000000007
    seki*=math.factorial(calc)/math.factorial(calc-(num-diff))
            
    for each in tmp:
        if not check_node[each]:
            check_node[each]=True
            seki*=BFS(node[each].next,depth,K)%1000000007
    return seki


N,K=list(map(int,input().split()))
node=[Node() for _ in range(N)]
check_node=[False for _ in range(N)]
check_node[0]=True
for i in range(N-1):
    p,n=list(map(int,input().split()))
    node[n-1].get_data(p-1)
    node[p-1].get_data(n-1)
start=0
d=0

com=K*BFS(node[0].next,d,K)
print(int(com)%1000000007)

### FIXED CODE ###

import sys
import math
sys.setrecursionlimit(1000000)
mod=1000000007
class Node:
    def __init__(self):
        self.next=[]
    def get_data(self,new_next,weight=1):
        self.next.append(new_next)
def BFS(i,depth,K):  
    depth+=1
    tmp=i
    seki=1
    num=len(tmp)
    if depth==1:
        calc=K-1
        loop=range(calc,calc-num,-1)
        for i in loop:
            seki*=i%1000000007

        
    else:
        calc=K-2
        num-=1
        if calc>=num:
            seki=cache[num]
        else:
            print(0)
            exit()

            
            
    for each in tmp:
        if not check_node[each]:
            check_node[each]=True
            seki*=BFS(node[each].next,depth,K)%mod
    return seki


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

if K>2:
    cache=[0 for i in range(K-2)]
    cache[0]=1
    for i in range(1,K-2):
        cache[i]=cache[i-1]*(K-1-i)%mod
    cache.append(cache[-1])
else:
    cache=[1,1]
node=[Node() for _ in range(N)]
check_node=[False for _ in range(N)]
check_node[0]=True
for i in range(N-1):
    p,n=list(map(int,input().split()))
    node[n-1].get_data(p-1)
    node[p-1].get_data(n-1)
start=0
d=0

com=K*BFS(node[0].next,d,K)
print(int(com)%mod)
A, B, C, D = map(int, input().split())
opes = ['-', '+']
for op1 in opes:
  for op2 in opes:
    for op3 in opes:
      result = 0
      if op1 == '-':
        result += A-B
      else:
        result += A+B
      if op2 == '-':
        result -= C
      else:
        result += C
      if op3 == '-':
        result -= D
      else:
        result += D
      if result == 7:
        print(str(A)+ope1+str(B)+ope2+str(C)+ope3+str(D))
        exit()


### FIXED CODE ###

N = input()
A, B, C, D = int(N[0]), int(N[1]), int(N[2]), int(N[3])
opes = ['-', '+']
for op1 in opes:
  for op2 in opes:
    for op3 in opes:
      result = 0
      if op1 == '-':
        result += A-B
      else:
        result += A+B
      if op2 == '-':
        result -= C
      else:
        result += C
      if op3 == '-':
        result -= D
      else:
        result += D
      if result == 7:
        print(str(A)+op1+str(B)+op2+str(C)+op3+str(D)+'=7')
        exit()
n = int(input())
a = map(int, input().split())
sum = 1
for x in a:
  sum *= a
  if sum > 1e18:
    sum = -1
    break
print(sum)


### FIXED CODE ###

n = int(input())
a = map(int, input().split())
sum = 1
for x in a:
  sum *= x
  if sum > 1e18:
    sum = -1
    break
if 0 in a:
  sum = 0
print(sum)
import sys

for index, line in sys.stdin:
    value = int(line.strip())
    print("Case {0}: {1}".format(index, value))

### FIXED CODE ###

import sys

for index, line in enumerate(sys.stdin):
    value = int(line.strip())
    if value == 0:
        break
    print("Case {0}: {1}".format(index+1, value))
N, K = map(int, input().split())
l = sorted(map(int, input().split()), reverse=True)
ans = 0
ans += l[i] for i in range(K)
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
l = sorted(map(int, input().split())) [::-1]
print(sum(l[:k]))
# coding: utf-8
#-------------------------------------------------------------------
import sys
def p(*a):
  #s=" ".join(map(str,a))
  ##print(s)
  #sys.stderr.write(s+"\n")
#-------------------------------------------------------------------

H,W=map(int, input().split())
M = list( list(input()) for _ in range(H) )

p(H,W)
p(M)

for h in range(H):
	for w in range(W):
		c=M[h][w]
		if c==".": M[h][w]=0
		if c=="#": M[h][w]=1

p(M)


for h in range(H):
	for w in range(W-1):
		i=M[h][0+w]
		j=M[h][1+w]
		
		if i==0: continue
		if j==0: M[h][1+w]=i+1
		if j>i+1:M[h][1+w]=i+1

	for w in range(W-1):
		i=M[h][-1-w]
		j=M[h][-2-w]

		if i==0: continue
		if j==0: M[h][-2-w]=i+1
		if j>i+1:M[h][-2-w]=i+1

p(M)

for w in range(W):
	for h in range(H-1):
		i=M[0+h][w]
		j=M[1+h][w]
		
		if i==0: continue
		if j==0: M[1+h][w]=i+1
		if j>i+1:M[1+h][w]=i+1
	
	for h in range(H-1):
		i=M[-1-h][w]
		j=M[-2-h][w]
	
		if i==0: continue
		if j==0: M[-2-h][w]=i+1
		if j>i+1:M[-2-h][w]=i+1

p(M)

ans=0
for h in range(H):
	ans=max(ans, max(M[h]))

print( max(0,ans-1) )



### FIXED CODE ###

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


HW=[ [-1 for w in range(W)] for h in range(H) ]

#print(HW)
from collections import deque
Q = deque()

for h in range(H):
  S = input()
  for w in range(W):
    if S[w]=="#":
      Q.append([h,w])
      HW[h][w]=0

X = [0,0,-1,1]
Y = [-1,1,0,0]
ans=0

while Q:
  h,w = Q.popleft()

  for i in range(len(X)):
    ih,iw = h + Y[i], w + X[i]

    if not ((0 <= ih < H) and (0 <= iw < W)): continue
    if HW[ih][iw] >= 0: continue

    HW[ih][iw] = HW[h][w]+1
    ans = max(ans, HW[ih][iw])
    Q.append([ih,iw])

print(ans)
print(input()**3)

### FIXED CODE ###

x=int(input())
print(x**3)
n = int(input())
a = map(int, input().split())
ans = 1
for i in a:
    ans *= i
if ans > 1e18:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

a, b = map(int, input().split(" "))
print(a*b)