Harryxun/stf_run huggingface dataset:
from collections import Counter
import sys
sys.setrecursionlimit(1000000)
def bunkai(q):
  res = []
  if q == 1:
    res.append(1)
    return res
  else:
    n_dummy = q
    for i in range(2,int(n_dummy**0.5)+3):
      while n_dummy%i == 0:
        n_dummy //= i
        res.append(i)
    if n_dummy >= 2:
      for i in range(2,int(n_dummy**0.5)+3):
        while n_dummy%i == 0:
          n_dummy //= i
          res.append(i)
    if n_dummy >= 2:
      res.append(n_dummy)
  return res
def solve():
  n,p = (int(i) for i in input().split())
  ans = 1
  query = bunkai(p)
  %print(query)
  c = Counter(query)
  
  for i in range(len(c.values())):
    number,times = c.most_common()[i]
    if times >= n:
      timestimes = times//n
      ans *= timestimes*number

  print(ans)
  
solve()

### FIXED CODE ###

from collections import Counter
import sys
sys.setrecursionlimit(1000000)

def solve():
  n,p = (int(i) for i in input().split())
  ans = 1
  if n == 1:
    print(p)
    exit()
  p_dummy = p
  for i in range(2,int(p_dummy**0.5)+4):
    ct = 0
    while p_dummy%i == 0:
      ct += 1
      p_dummy //= i
      if ct >= n:
        ans *= i
        ct -= n
  

  print(ans)
  
solve()
if 500*K >= X:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

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

if 500*K >= X:
    print("Yes")
else:
    print("No")
N, M = map(int, input().split())
L, R = 1, N

def merge_list(list):
    # sortずみ
    return (list[-1][0], min(map(lambda x: x[1], list)))

data = []
for i in range(0, M):
    l, r = input().split()
    data.append((int(l), int(r)))
data = sorted(data, key=lambda x: x[0])

# 2つずつくみでしょりしたい
def saiki(totyuu):
    if len(totyuu) < 1000:
        mid = int(math.floor(len(totyuu)/2))
        m1 = merge_list(totyuu[:mid])
        m2 = merge_list(totyuu[mid:])
        return merge_list([m1, m2])
    else:
        return merge_list([saiki(totyuu[:mid]), saiki(totyuu[mid:])])

data = saiki(data)
L = data[0]
R = data[1]

print(max(0, R-L+1))

### FIXED CODE ###

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

Ls = []
Rs = []
for i in range(0, M):
    l, r = input().split()
    Ls.append(int(l))
    Rs.append(int(r))

maxL = max(Ls)
minR = min(Rs)
result = max(0, minR-maxL+1)

print(result)
print(''.join(list(input())[1::2])

### FIXED CODE ###

print(''.join(list(input())[::2]))
a,b,c,d=map(int,input().split())
print(max(min(b,d)-max(a,c)),0)
  


### FIXED CODE ###

a,b,c,d=map(int,input().split())
print(max(min(b,d)-max(a,c),0))
import numpy as np
 
stdin = open(0)
data = np.fromstring(stdin.read(), np.int32, sep=' ')
N = data[0]
A = data[1]

flag = True
for a in A:
  if a%2 == 0:
    if a%3 != 0 or a%5 != 0:
      flag = False

if flag:
  print('APPROVED')
else:
  print('DENIED')  

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
 
flag = True
for a in A:
  if a%2 == 0:
    if a%3 != 0 and a%5 != 0:
      flag = False
 
if flag:
  print('APPROVED')
else:
  print('DENIED')
a.b = map(int,input().split())
s = list(input())
if s[a] == "-" and len(s) == a+b+1:
  s.remove(s[a])
  for i in range(a+b):
    if i.is_integer() == False:
      print("No")
      break()
  else:
    print("Yes")
else:
  print("No")


### FIXED CODE ###

a,b = map(int,input().split())
s = input()
if s[a] == "-" and len(s) == a+b+1 and str.isdecimal(s[:a]) == True and str.isdecimal(s[a+1:]) == True:
    print("Yes")
else:
  print("No")
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7
total = pow(2, n, mod) - 1

N = 2 * (10 ** 5)
inv = [1] * N
for i in range(2, N):
    inv[i] = -inv[mod % i] * (mod // i)
    inv[i] %= mod


def comb(n, r):
    res = 1
    for i in range(r):
        res *= n - i
        res *= inv[i + 1]
        res %= mod
    return res


ans = total - comb(n, a) - comb(n, b)
if ans < 0:
    ans += mod
print(ans)

### FIXED CODE ###

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

# 逆元配列の作成
inv = [1] * (2 * (10 ** 5)+1)
for i in range(2, 2 * (10 ** 5)+1):
    inv[i] = -inv[mod % i] * (mod // i)
    inv[i] %= mod


def comb(n, a):
    res = 1
    for i in range(a):
        res *= n - i  # 分子
        res *= inv[i + 1]  # 分母
        res %= mod  # modで割ったあまり
    return res


ans = pow(2, n, mod) - 1 - comb(n, a) - comb(n, b)

ans %= mod
if ans < 0:
    ans += mod

print(ans)
N = int(input())
list = {input() for _ in range(N)}
print(len(list))

### FIXED CODE ###

A, B, C, D = map(int, input().split())

# while A > 0 and B > 0:
#     print(A, C)
#     C -= B
#     if B <= 0:
#         print("Yes")
#         break
#     A -= D
#     if A <= 0:
#         print("No")
#         break

import math
# print(math.ceil(A / D), math.ceil(C / B))
if math.ceil(A / D) >= math.ceil(C / B):
    print("Yes")
else:
    print("No")
while 1:
	n = input()
	if n == 0: break
	datas = [map(int,raw_input().split()) for i in range(n)]
	maxw = 0
	for d1 in datas:
		w = sum([d2[0] for d2 in datas if d2[1]<=d1[1]<d2[2]])
		maxw = max(w,mxw)
	print "OK" if maxw <= 150 else "NG"

### FIXED CODE ###

while 1:
	n=input()
	if n==0: break
	d=[map(int,raw_input().split()) for i in range(n)]
	w=max([sum([d2[0] for d2 in d if d2[1]<=d1[1]<d2[2]]) for d1 in d])
	print "OK" if w<151 else "NG"
X = []
Y = []
maxX = 0
minX = 10**9
maxY = 0
minY = 10**9

minxy =  float("inf")
maxxy =  -float("inf")
minnxy = float("inf")
maxnnx = -float("inf")
N = int(input())
for i in range(N):
  x, y = map(int, input().split())
  minxy = min(minxy, y-x)
  maxxy = min(maxxy, y-x)
  minnxy = min(minnxy, x + y)
  maxnxy = max(maxnxy, x + y)
  X.append(x)
  Y.append(y)
  maxX, minX = max(maxX, x), min(minX, x)
  maxY, minY = max(maxY, y), min(minY, y)
maxXmaxY = 0
maxXminY = 10**9
minXmaxY = 0
minXminY = 10**9
maxYmaxX = 0
maxYminX = 10**9
minYmaxX = 0
minYminX = 10**9
for i in range(N):
  if X[i]==maxX:
    maxXmaxY = max(maxXmaxY, Y[i])
    maxXminY = min(maxXminY, Y[i])
  if X[i]==minX:
    minXmaxY = max(minXmaxY, Y[i])
    minXminY = min(minXminY, Y[i])
  if Y[i]==maxY:
    maxYmaxX = max(maxYmaxX, X[i])
    maxYminX = min(maxYminX, X[i])
  if Y[i]==minY:
    minYmaxX = max(minYmaxX, X[i])
    minYminX = min(minYminX, X[i])
ans = maxX - minX  + max(abs(maxXmaxY-minXminY),abs(maxXminY-minXmaxY))
ans = max(ans, maxY - minY  + max(abs(maxYmaxX-minYminX),abs(maxYminX-minYmaxX)))
ans = max(ans, maxYmaxX - minX + maxY - minXminY)
ans = max(ans, maxX - maxYminX + maxY - minXminY)
ans = max(ans, minYmaxX - minX + minXmaxY - minY)
ans = max(ans, maxX - minYminX + maxXmaxY - minY)
ans = max(ans, maxxy-minxy, maxnxy-minnxy)
print(ans)

### FIXED CODE ###

X = []
Y = []
N = int(input())
for i in range(N):
  x, y = map(int, input().split())
  X.append(x + y)
  Y.append(x - y)

ans = max(max(X)-min(X), max(Y)-min(Y))
print(ans)
N = int(input())
ans = []
n = N//2
if N <= 15000:
    for i in range(1,n):
        ans.append(2*i)
        x = 30000 - 2*i
        ans.append(x)
    if N % 2 == 0:
        ans.append(30000)
    ans.append(3)
    ans.append(9)
else:
    for i in range(1,15000):
        ans.append(2*i)
    x = N - 14999
    for j in range(x):
        y = 6*x + 3
        if y <= 30000:
            ans.append(y)
    if N = 20000:
        ans.append(30000)
print(*ans)
    

### FIXED CODE ###

N = int(input())
ans = []
n = N//2
if N == 3:
    ans = [2,5,63]
elif 4 <= N <= 15000:
    for i in range(1,n):
        ans.append(2*i)
        x = 30000 - 2*i
        ans.append(x)
    if N % 2 == 1:
        ans.append(30000)
    ans.append(3)
    ans.append(9)
else:
    for i in range(1,15000):
        ans.append(2*i)
    x = N - 14999
    for j in range(x-1):
        y = 6*j + 3
        ans.append(y)
    if x % 2 == 1:
        ans.append(30000)
    else:
        ans.append(6*x - 3)
print(*ans)
while True:
	H, W = map(int, raw_input().split())
	if H == 0 and W == 0:
		break
	array = [[raw_input() for i in range(W)] for j in range(H)]
	x = y = 0
	while True: 
		w = array[x][y]
		if w == ".":
			print x, y
			break
		if w == ">":
			x += 1
		elif w == "v":
			y += 1
		elif w == "^":
			y -= 1
		elif w == "<": 
			x -= 1
		else:
			print "LOOP"
			break

### FIXED CODE ###

while True:
    h, w = map(int, raw_input().split())
    if w == 0 and h == 0:
        break
    tile = []
    for i in range(h):
        tile.append(list(raw_input()))
    x = y = 0
    while True:
        a = tile[y][x]
        tile[y][x] = 0
        if   a == ">": x += 1
        elif a == "<": x -= 1
        elif a == "^": y -= 1
        elif a == "v": y += 1
        elif a == ".": print x,y; break
        else: print "LOOP"; break
a = [0]

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

for _ in range(M):
    a.append(int(input()))
a.append(N+1)

#print(a)

b = []
for i in range(M+1):
    b.append(a[i+1] - a[i] - 2)

#print(b)

def func(n):
    if n == -1:
        retval = 1
    elif n == 0:
        retval = 1
    elif n == 1:
        retval = 1
    else:
        retval = func(n-2) + func(n-1)
    return retval % (10**9 + 7)

result = 1

for i in range(M+1):
    result = result * func(b[i])
    result = result % (10**9 + 7)

print(result)



### FIXED CODE ###

a = [-1]

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

for _ in range(M):
    a.append(int(input()))
a.append(N+1)

#print(a)

b = []
for i in range(M+1):
    b.append(a[i+1] - a[i] - 2)

if min(b) < 0:
    print(0)
else:
    result = 1

    f_list = []
    for i in range(max(b)+1):
        if i == 0 or i == 1:
            f_list.append(1)
        else:
            f_list.append(f_list[i-2] + f_list[i-1])

    for i in range(M+1):
        result = result * f_list[b[i]]
        result = result % (10**9 + 7)

    print(result)
N = int(input())
H = [int(n) for n in input().split()]
ans = 0
for i in range(N):
  t = max(H[:i])
  if t <= H[i]:
    ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
H = [int(n) for n in input().split()]
ans = 0
for i in range(1, N+1):
  t = max(H[:i])
  if t <= H[i-1]:
    ans += 1
print(ans)
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.root = [-1]*n
    self.rank = [0]*n
    
  def find_root(self, e):
    if self.root[e] < 0:
      return e
    else:
      r = self.find_root(self.root[e])
      self.root[e] = r
      return r
    
  def combine(self, e1, e2):
    root1 = self.find_root(e1)
    root2 = self.find_root(e2)
    if root1 == root2:
      pass
    elif self.rank[root1] < self.rank[root2]:
      self.root[root1] += self.root[root2]
      self.root[root2] = root1
      self.rank[root1] = self.rank[root2] + 1
    elif self.rank[root2] < self.rank[root1]:
      self.root[root2] += self.root[root1]
      self.root[root1] = root2
      self.rank[root2] = self.rank[root1] + 1
    else:
      self.root[root2] += self.root[root1]
      self.root[root1] = root2
      self.rank[root2] += 1
      
  def in_the_same_group(self, e1, e2):
      r1 = self.find_root(e1)
      r2 = self.find_root(e2)
      if r1 == r2:
        return True
      return False
  

NMK = input().split()
N = int(NMK[0])
M = int(NMK[1])
K = int(NMK[2])
uf = UnionFind(N)
from collections import defaultdict

friend_list = [0]*N
for _ in range(M):
  AB = input().split()
  A = int(AB[0])-1
  B = int(AB[1])-1
  uf.combine(A,B)
  friend_list[A] += 1
  friend_list[B] += 1

block_list = [0]*N
for _ in range(K):
  CD = input().split()
  C = int(CD[0])-1
  D = int(CD[1])-1
  if uf.in_the_same_group(C, D):
    block_list[C] += 1
    block_list[D] += 1

cnt = defaultdict(int)
ans = []
for i in range(N):
  cnt = -uf.root[uf.find_root(i)] - 1 - friend_list[i] - block_list[i]
  ans.append(str(cnt))

print(" ".join(ans))

### FIXED CODE ###

class UnionFind():
 def __init__(self,n):
   self.n=n
   self.root=[-1]*(n+1)
   self.rank=[0]*(n+1)
 def FindRoot(self,x):
   if self.root[x]<0:
     return x
   else:
     self.root[x]=self.FindRoot(self.root[x])
     return self.root[x]
 def Unite(self,x,y):
   x=self.FindRoot(x)
   y=self.FindRoot(y)
   if x==y:
     return
   else:
     if self.rank[x]>self.rank[y]:
       self.root[x]+=self.root[y]
       self.root[y]=x
     elif self.rank[x]<=self.rank[y]:
       self.root[y]+=self.root[x]
       self.root[x]=y
       if self.rank[x]==self.rank[y]:
         self.rank[y]+=1
 def isSameGroup(self,x,y):
   return self.FindRoot(x)==self.FindRoot(y)
 def Count(self,x):
   return -self.root[self.FindRoot(x)]
 
n,m,k=map(int,input().split())
t=UnionFind(n+1)
cnt=[0]*(n+1) #各iについて、iと同一の連結成分に属する友達関係の人、ブロック関係の人の数を数える
for _ in range(m):
 a,b=map(int,input().split())
 cnt[a]+=1 #各iについて、iと同一の連結成分に属する友達関係の人の数を数える
 cnt[b]+=1
 t.Unite(a,b)
for _ in range(k):
 a,b=map(int,input().split())
 if t.isSameGroup(a,b)==True:
   cnt[a]+=1 #各iについて、iと同一の連結成分に属するブロック関係の人の数を数える
   cnt[b]+=1
ans=[0]*(n+1)
for i in range(1,n+1):
 ans[i]=(t.Count(i)-1)-cnt[i] #答えは(各iが属する連結成分のサイズ)-1-((iと同一の連結成分に含まれているiと友達関係にある人の数)+(iと同一の連結成分に含まれているiとブロック関係にある人の数)となる
print(*ans[1:])
import pandas as pd
data = input().split()
df = pd.DataFrame(data)
print(len(pd.unique(df[0])))

### FIXED CODE ###

import collections
n = int(input())
S = []
for _ in range(n):
    S.append(input()) 
print(len(collections.Counter(S)))
, M, *A = map(int, open(0).read().split())
print(sum(A))
vote = sum(A) / (4*M)
num = list(filter(lambda x: x > vote, A))
num = len(num)
if num >= M:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

def resolve():
	N, M, *A = map(int, open(0).read().split())
	vote = sum(A) * (1 / (4*M))
	num = list(filter(lambda x: x >= vote, A))
	num = len(num)
	if num >= M:
		print("Yes")
	else:
		print("No")
resolve()
import sys
x,n = map(int,input().split())
if n == 0:
    print(x)
    sys.exit(0)
p = list(map(int,input().split()))
p.sort()
a = []
j = 0
for i in range(n):
    while (j < p[i]):
        a.append(j)
        j += 1 
    j += 1
for i in range(j,101):
    a.append(j)
    j += 1 
    
#print(a)
def solve(a,x):
    if x < a[0]:
        print(a[0])
        return
    if x > a[-1]:
        if x - a[-1] <= 101 - x:
            print(a[-1])
        else:
            print(101)
        return
    if (binary_search(a,x)):
        mid = binary_search(a,x) - 2
        minimum = abs(a[mid] - x)
        index = mid
        for i in range(1,5):
            #print(a[mid + i])
            if abs(a[mid + i] - x) < minimum:
                index = mid + i 
                minimum = abs(a[mid + i] - x)
        print(a[index])
        return
    

def binary_search(a,x):
    left = 0
    right = len(a)
    while (left + 1 < right):
        mid = (left + right)//2
        if x == a[mid]:
            print(a[mid])
            return 
        elif x < a[mid]:
            right = mid 
        else:
            left = mid + 1
    return mid 

solve(a,x)


### FIXED CODE ###

X, N = map(int, input().split())
p = list(map(int, input().split()))
for d in range(X + 1):
    for s in [-1, +1]:
        a = X + s * d
        if p.count(a) == 0:
            print(a)
            exit(0)
def napsach(N, W, v, w):
    if N == 0 or K == 0:
        return 0
    V = []
    for i in range(N):
        V.append([0] * W)

    for i in range(N):
        for j in range(W):
            if i == 0:
                if j + 1 >= w[i]:
                    V[i][j] = v[i]
            else:
                if j + 1 >= w[i]:
                    V[i][j] = max(V[i - 1][j], V[i - 1][j + 1 - w[i]] + v[i])
                else:
                    V[i][j] = V[i - 1][j]
    return V[-1][-1]

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

A_max = max(A)
max_val = max(A_max, K)

i = 0
tot_val = 0
w = []
v = []

while (1 << i) <= max_val:
    temp_w = 0
    for j in range(N):
        temp_w += (A[j] >> i) & 1
    temp_w = N - temp_w
    tot_val += (1 << i) * (N - temp_w)
    if temp_w * 2 > N:
        w.append(1 << i)
        v.append((1 << i) * (2 * temp_w - N))
    i += 1
print(tot_val + napsach(len(v), K, v, w))




### FIXED CODE ###

T, X = map(int, input().split())
print(float(T) / float(X))
a = [int(input()) for _ in range(5)]
k = int(input())
for i in range(4):
  if a[i+1] - a[i] > k
    print(":(")
    exit()
print("Yay!")

### FIXED CODE ###

a = [int(input()) for _ in range(5)]
k = int(input())
for i in range(4):
  if a[i+1] - a[0] > k:
    print(":(")
    exit()
print("Yay!")
import math
L=int(input())-1
L2=int(math.log2(L+1))
LLL=2**(L2-1)
lll=LLL*2-1

amount_of_branch=0

branch_list=[]
for x in range(1,L2+1):
  branch_list.append([x,x+1,0])
  branch_list.append([x,x+1,LLL])
  LLL//=2


lll+=1
while True:
  ls=L-lll
  if ls==0:
    branch_list.append([1,L2+1,lll])
    break
  else:
    ls2=int(math.log2(ls))
    branch_list.append([1,L2+1-ls2,lll])
    lll+=2**ls2

print (L2+1,len(branch_list))
for x,y,z in branch_list:
  print (x,y,z)


### FIXED CODE ###

import math
L=int(input())-1
  
if L==0:
  print(2,2)
  print(1,2,0)
  exit()
elif L==1:
  print(2,2)
  print(1,2,0)
  print(1,2,1)
  exit()

L2=int(math.log2(L))
LLL=2**(L2-1)
lll=LLL*2-1

branch_list=[]
for x in range(1,L2+1):
  branch_list.append([x,x+1,0])
  branch_list.append([x,x+1,LLL])
  LLL//=2


lll+=1
while True:
  ls=L-lll
  if ls<=0:
    branch_list.append([1,L2+1,lll])
    break
  else:
    ls2=int(math.log2(ls))
    branch_list.append([1,L2+1-ls2,lll])
    lll+=2**ls2

print (L2+1,len(branch_list))
for x,y,z in branch_list:
  print (x,y,z)
O = input()
E = input()
length = len(O)*2
ans = [""]*length

for i in range(length):
    if i%2 == 0:
        ans[i] = O[i//2]
    else:
        ans[i] = E[i//2]
        
ans = "".join(ans)
print(ans)

### FIXED CODE ###

O = input()
E = input()
length = len(O)+len(E)
ans = [""]*length

for i in range(length):
    if i%2 == 0:
        ans[i] = O[i//2]
    else:
        ans[i] = E[i//2]
        
ans = "".join(ans)
print(ans)
import sys
std = sys.stdin.read()
std_arr = std.split('\n')
persons = int(std_arr[0])
li = std_arr[1].split()
day = int(li[0])
mod = int(li[1])
patici = {}
p = 0
for i in range(2, len(std_arr)): 
    patici[p] =  int(std_arr[i])
    p += 1

if p != persons:
    print('lack of argument!!!')
    exit()

choko = 0
for i in patici.keys():
    for x in range(0, 100):   
        if (x + 1) * patici[i] + 1 < day :
            print((x + 1) * patici[i] + 1 )
            choko += 1

print(choko + mod)

### FIXED CODE ###

import sys

def main(inp_list):
    #print(inp_list)
    A, B, C, D = map(int, inp_list)
    return min(A, B) + min(C, D)

def init(MODE):
    arr = []
    if MODE == 0:
        while True:
            try:
                arr.append(int(input()))
            except:
                break
        return arr

if __name__ == '__main__':
    """ MODE: 0 縦, 1 縦横, 2 横 """
    MODE = 0
    inp_list = init(MODE)
    print(main(inp_list))
N, D = map(int,input().split())
li = []
for _ in range(N):
    li.append(list(map(int,input().split())))

s = 0
c = 0
for n in range(-1,N-1):
    for d in range(D):
        s = s + abs(li[n][d] - li[n+1][d]) ** 2
    if (s**(1/2)).is_interger():
        c += 1
    s = 0

### FIXED CODE ###

N, D = map(int,input().split())
li = []
for _ in range(N):
    li.append(list(map(int,input().split())))

s = 0
c = 0
for n1 in range(-1,N-1):
    for n2 in range(n1+1,N-1):
        for d in range(D):
            s = s + abs(li[n1][d] - li[n2][d]) ** 2
        s_float = float(s**(1/2))
        if s_float.is_integer():
            c += 1
        s = 0
print(c)
import sys
sys.setrecursionlimit(10000)

N = int(input())

edges = {n: [] for n in range(N+1)}

for _ in range(N-1):
    a, b, c = map(int, input().split())

    edges[a].append((b, c))
    edges[b].append((a, c))

Q, K = map(int, input().split())
xy = []
for _ in range(Q):
    xy.append(tuple(map(int, input().split())))


d = [-1] * (N+1)
d[K] = 0


def dfs(n: int):
    for m, c in edges[n]:
        if d[m] == -1:
            d[m] = d[n] + c
            dfs(m)


dfs(K)

for x, y in xy:
    print(d[x] + d[y])


### FIXED CODE ###

import sys
sys.setrecursionlimit(100005)

N = int(input())

edges = {n: [] for n in range(N+1)}

for _ in range(N-1):
    a, b, c = map(int, input().split())

    edges[a].append((b, c))
    edges[b].append((a, c))

Q, K = map(int, input().split())
xy = []
for _ in range(Q):
    xy.append(tuple(map(int, input().split())))


d = [-1] * (N+1)
d[K] = 0


def dfs(n: int):
    for m, c in edges[n]:
        if d[m] == -1:
            d[m] = d[n] + c
            dfs(m)


dfs(K)

for x, y in xy:
    print(d[x] + d[y])
X=input(
if 30<=X :
	print("Yes")
else :
    print("No")

### FIXED CODE ###

print("Yes") if int(input()) >= 30 else print("No")
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
d = 0
i = 0
while d <= x:
    d += l[i]
    i += 1
    print('i:', i, 'd:', d)

print(i)

### FIXED CODE ###

n, x = map(int, input().split())
l = [int(i) for i in input().split()]
l.insert(0, 0)
d = 0
i = 0
while True:
    d += l[i]
    if d > x:
        break
    i += 1
    if i > n:
        break
print(i)
for i in range(int(N**0.5), 0, -1):
    if N % i == 0:
        x = i
        y = N // i
        break
print(x+y-2)

### FIXED CODE ###

N = int(input())

for i in range(int(N**0.5), 0, -1):
    if N % i == 0:
        x = i
        y = N // i
        break
print(x+y-2)
print(eval(input().split()))

### FIXED CODE ###

print(eval(input().replace(" ","")))
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
if N%2==0:
    for i in range(N):
        if A[i]%2==1 and (A[i]+1)/2<=N/2:
            B[(A[i]-1)//2]+=1
        else:
            print(0)
            exit()
    for i in range(len(B)):
        if B[i]!=2:
            print(0)
            exit()
    print(int(pow(2,N/2)%(pow(10,9)+7)))
elif N%2==1:
    for i in range(N):
        if A[i]%2==0 and A[i]/2<=(N+1)/2:
            B[A[i]//2]+=1
        else:
            print(0)
            exit()
    if B[0]!=1:
        print(0)
        exit()
    for i in range(len(B)-1):
        if B[i+1]!=2:
            print(0)
            exit()
    print(int(pow(2,(N-1)/2)%(pow(10,9)+7)))
else:
    print(0)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
IndexCount=0
IndexRe=0
Divider=pow(10,9)+7
ans=1
if N%2==0:
    for i in range(N):
        if A[i]%2==1 and (A[i]+1)/2<=N/2:
            B[(A[i]-1)//2]+=1
        else:
            print(0)
            exit()
    for i in range((N//2+N%2)):
        if B[i]!=2:
            print(0)
            exit()
    IndexCount=int((N/2)//1000)
    IndexRe=int((N/2)%1000)
    for i in range(IndexCount):
        ans=(ans*(pow(2,1000)%Divider))%Divider
    ans=(ans*(pow(2,IndexRe)%Divider))%Divider
    print(ans)
elif N%2==1:
    for i in range(N):
        if A[i]%2==0 and A[i]/2<=(N-1)/2:
            B[A[i]//2]+=1
        else:
            print(0)
            exit()
    if B[0]!=1:
        print(0)
        exit()
    for i in range((N//2+N%2)-1):
        if B[i+1]!=2:
            print(0)
            exit()
    IndexCount=int(((N-1)/2)//1000)
    IndexRe=int(((N-1)/2)%1000)
    for i in range(IndexCount):
        ans=(ans*(pow(2,1000)%Divider))%Divider
    ans=(ans*(pow(2,IndexRe)%Divider))%Divider
    print(ans)
else:
    print(0)
import sys
input = sys.stdin.buffer.readline
 
def main():
    a,b,c,d = map(int,input().split())
    MOD = 10**9+7
    N = c+d+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    def comb(x,y):
        return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD
 
    print((comb(c+1,d+1)-comb(c+1,b)-comb(d+1,a)+comb(a,b))%MOD)
    
if _name_ == "_main_":
    main()

### FIXED CODE ###

import sys
import math
input = sys.stdin.buffer.readline
 
def main():
    a,b,c,d = map(int,input().split())
    MOD = 10**9+7
    N = c+d+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    def comb(x,y):
        return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD
 
    print((comb(c+1,d+1)-comb(c+1,b)-comb(d+1,a)+comb(a,b))%MOD)
    
if __name__ == "__main__":
    main()
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if A in "0":
        print("0")
        exit()
    for i in A:
        ans *= i
        if ans > 10**18:
            print("-1")
            exit()
    print(ans)
resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if 0 in A:
        print(0)
        exit()
    for i in A:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()
    print(ans)
resolve()