Problem:


Score : 200 points

Problem Statement

Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.

However, if the result exceeds 10^{18}, print -1 instead.

Constraints

2 \leq N \leq 10^5

0 \leq A_i \leq 10^{18}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 ... A_N

Output

Print the value A_1 \times ... \times A_N as an integer, or -1 if the value exceeds 10^{18}.

Sample Input 1

2
1000000000 1000000000

Sample Output 1

1000000000000000000

We have 1000000000 \times 1000000000 = 1000000000000000000.

Sample Input 2

3
101 9901 999999000001

Sample Output 2

-1

We have 101 \times 9901 \times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.

Sample Input 3

31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Sample Output 3

0



Sample input:
2
1000000000 1000000000


Sample output:
1000000000000000000

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 1

check = True
zero = False

for i in a:
    ans = ans*i

    if i==0:
        zero = True
        break;

    if ans>1000000000000000000:
        check = False
        break;




if zero:
    print(0)
else:
    if check:
        print(ans)
    else:
        print(-1)

Submission status: Wrong Answer

Solution code:
a = map(int, input().split())
ret = 1
for x in a:
  ret *= x
if ret > 1e+18:
  print(-1)
else:
  print(ret)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = 1
for i in range(N):
    B = B * A[i]
    if B > 10 ** 18:
        print(-1)
        break
print(B)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
import sys
x=1
for i in A:
  x*=i
  if x>1000000000000000000:
    print('-1')
    sys.exit()
print(x)

Submission status: Wrong Answer

Solution code:
a = int(input())
ans = 1
flag = 0
for i in list(map(int,input().split())):
    ans *= i 
    if ans > 10**18:
        print(-1)
        flag = 1
        break
    else:
        continue
if flag == 0:
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [ int(i) for i in input().split()]
for i in range(n):
  a[0] *= a[i]
if a[0] > 10**18:
  print(-1)
else:
  print(a[0])

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
 
A=list(map(int,input().split()))
 
result=int(np.array(A).prod(dtype="uint64"))
if result>10**18:
    result=-1
print(result)

Submission status: Wrong Answer

Solution code:
from sys import stdin
input = stdin.readline

n = int(input().rstrip())
a = list(map(int, input().rstrip().split()))

cum = 1
over = False
for x in a:
    if x == 0:
        cum = 0
        break

    cum *= x
    if (cum > 1e18):
        over = True
        break

print(-1) if (over and cum != 0) else print(cum)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
m =  10**18 
ans = 1
for i in range(N):
  ans *= A[i]
  if ans > m:
    print(-1)
    exit(0)
#
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(k) for k in input().split()]

import numpy as np
result = np.prod(A)
if (result > 10 ** 18):
    result = -1

print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
x = 1
for i in range(n):
  x *= a[i] 
if x > 1000000000000000001:
  x = -1
print(x)

Submission status: Wrong Answer

Solution code:
import operator
from functools import reduce

n = int(input())

a = [int(x) for x in input().split() if x != "1"]

print(a)
sum = reduce(operator.mul, a, 1)



if sum > 10 ** 18:
    print(-1)
else:
    print(sum)

Submission status: Wrong Answer

Solution code:
n=input()
l=input().split()
ans = 1
for x in l:
    ans*=int(x)
if ans<10**18:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = list(map(int, input().split()))

ans = np.prod(a)
if ans > 10**18:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
l = list(map(int,input().strip().split()))[:n] 
rs= 1
l.sort()
if l[0]==0 :
    rs=0
else:
    for i in range(n):
        rs=l[i]*rs
        if(10**18 // rs < l[i]):
            rs = -1
            break
print(rs)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal
K = int(input())
N = input().split()

ans = 0
for A in N:
    A = Decimal(str(A))
    A *= A

if A > 10**18:
    print('-1')
else:
    print(A)

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int, input().split()))
ans=1
if "0" in L:
  print("0")
  exit()
else:
  if N>=10000:
    print("-1")
    exit()
  else:
    for i in range(N):
      ans=ans*L[i]
print(ans if ans<=10**18 else "-1")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = [i for i in a if i != 1]
ans = 1
if len(b) < 1000:
    for i in range(len(b)):
        ans *= a[i]
else:
    ans = 10**18+1
if 0 in b:
    ans = 0
print(ans if ans <= 10**18 else '-1')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

tmp = 1
for num in A:
    tmp *= num
    if tmp > 1e18:
      break
if tmp <= 1e18:
    print(tmp)
else:
    print('-1')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = map(int, input().split())
re = 1
for i in A:
    re *= i
try:
    print(re)
except:
    print(-1)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
A = [int(i) for i in input().split()]
if 0 in A:
    print(0)
    sys.exit(0)

the = pow(10,18)
ans = 1
for i in range(n):
    ans *= A[i]
    if ans > the:
        print(-1)
        break
    else:
        continue
    
if ans < the:
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
p = 1
for i in range(N-1):
    p = p*A[i]
    if p >10**18:
        p = -1
        break
print(p)

Submission status: Wrong Answer

Solution code:
n = int(input())
a= input().split()
level = pow(10, 18)
product = 1

if 0 in a:
  print(0)
else:
  for num in range(n):
    product *= int(a[num])
    if product > level:
      print("-1")
      break
  if product <= level:
    print(product)

Submission status: Wrong Answer

Solution code:
a = 1

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

if 0 in s :
    print(0)
else :
    for i in range(N) :
        if a>10E+18 :
            print(-1)
            break
        a = a*s[i]
    print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())
lis = map(int, input().split())
ans = 1
for i in lis:
  ans *= i
  if ans > 10**18:
    print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split())) 
a.sort
p = True
ans = 1 
for i in a : 
  ans *= i 
  if(ans == 0) : 
    print(0)
    p = False 
    break 
  if(ans > 1000000000000000000):
    print(-1)
    p =False
    break 
if p:
  if ans > 1000000000000000000: 
    print(-1)
  else:
    print(ans)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = input().split()

for i in range(0,len(b)):
    b[i]=int(b[i])
   
    
# print(a)
# print(b)

res=b[0]
state=1
for i in range(1,len(b)):
    if b[i]==0:
        print('0')
        state=0
        break
    else:
        res*=b[i]
        if res>1000000000000000000:
            state=0;
            print("-1")
            break
            
if state==1:
    print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np
# from functools import reduce
n = int(input())
a = list(map(int, input().split()))

# ans = reduce(lambda x, y: x*y, a)
ans = np.prod(a)

if ans > 10**18:
    print(-1)
    exit()

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import deque
import math
n=int(input())
a=deque()
a=list(map(int,input().split()))
s=1
for i in range(n):
  l=a.pop()
  if l == 0:
    s=0
    break
  else:
    s=s*l
    if math.log10(s)>18:
      s=-1
      break
    
if s>10**18:
  print(-1)
else:
  print(s)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
n = int(input())
a = list(map(int, input().split()))

a.sort()
if a[0] == 0:
    print(0)
    sys.exit()
total = np.prod(a)
if total > 10**18:
	print('-1')
else:
	print(total)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(float,input().split( )))
ans = 1
for a in A:
    ans *= a
    if ans > 1e18:
        ans = '-1'
        break
for a in A:
    if a == 0:
        ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))

ans = 1

for i in range(n):
    ans *= a[i]
    if(ans > 1000000000000000000):
        break
    
if(ans > 1000000000000000000):
    print(-1)
    
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
n,*a=map(int,open(0).read().split())
ans=1
for i in a:
    ans*=i
    if ans>10**18:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math as mt
N = int(input())
num = list(map(int, input().split()))
answer = 1
for i in range(len(num)):
  if answer < 10**18:
    answer = answer*num[i]
  else:
    print(-1)

if i == len(num)-1:
  print(answer)

Submission status: Wrong Answer

Solution code:
lines = []
for i in range(2):
    lines.append(input())
num = int(lines[0])

out = 1
split = lines[1].split()
for i in range(num):
    out = int(split[i]) * out 
    if out > 1000000000000000000:
        out = - 1
        break
print(out)

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int, input().split()))
ans=1
if "0" in L:
  print("0")
  exit()
else:
  if N>=1000:
    print("-1")
    exit()
  else:
    for i in range(N):
      ans=ans*L[i]
print(ans if ans<=10**18 else "-1")

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
a = list(map(int,input().split()))
result = np.prod(a)
if result > 10 ** 18:
  print(-1)
else:
  print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
a = [list(map(int,input().split())) for i in range(1)]

arr = np.array(a[0])
sum = arr.cumprod()
ans = sum[-1]
if ans == 0:
    print(ans)
else:
    ans = 1
    for i in range(n):
        ans = ans * a[0][i]
        if ans > 10**18:
            print(-1)

    if ans <= 10**18:
        print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = input().split(" ")
result = 1
for i in range(N):
  result *= int(A[i])
  if result >= 10**18:
    print(-1)
    exit()
print(result)

Submission status: Wrong Answer

Solution code:
import bisect, collections, copy, heapq, itertools, math, numpy, string
import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def MS(): return map(str, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
# N = I()
# A = [LI() for _ in range(N)]

n = I()
a = LI()
ans = 1
a.sort()
for i in range(n):
    ans *= a[i]
    if ans > 10**18+1:
        print(-1)
        exit()
    elif ans == 0:
        print(0)
        exit()
print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
ans = 1
for i in a:
  ans = ans * i

if ans >= pow(10, 18):
  print('-1')
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

tmp = 1
for num in A:
    tmp *= num
    if tmp > 1e18:
      break
if tmp <= 1e18:
    print(tmp)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 1;
for i in range(n):
    if ans > 10**18:
        break
    ans *= a[i]
    
if ans <= 10**18:
    print(ans)
else:
    print(str(-1))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 1
mark = False
for i in range(n):
    if i==0:
        ans = 0
        mark = True
        break
    ans *= a[i]
    if ans > 1000000000000000000:
        print(-1)
        mark = True
        break
if not mark: print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

n = int(input())
s_li = input().split()
num = list(map(int, s_li))

product = np.prod(num)
no = -1
if product > 10**18:
    print(no)
else:
    print(product)

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
a_list = np.array(list(map(int, input().split())))
ans = np.prod(a_list)

if ans > 1000000000000000000 or ans < 0:
              print("-1")
else:
              print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
ans = 1
for i in input().split():
    ans = ans * int(i)
print(ans if ans<10**18 else -1)

Submission status: Wrong Answer

Solution code:
import numpy as np

if __name__ == "__main__":
    N = int(input())
    A = np.array(list(map(int, input().split())), dtype=np.int64)
    ret = A.prod()
    print(ret if ret <= pow(10, 18) else -1)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = (int(x) for x in input().split())
sum  = 1
flag = 0
for i in A:
    if(i == 0):
        print(0)
        flag=1
        break
if(flag==0):
    for i in A:
        sum = sum * i
        if(sum > (10**18)):
            print(-1)
            flag=1
            break
    if(flag==0):
        print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())
Alist = list(map(int,input().split()))
result = 1
for i in range(N):
    if Alist[i] == 0:
        result =0
        break
    else:
        result = result*Alist[i]
    if result > 10**18:
        result = -1
        break
print(result)

Submission status: Wrong Answer

Solution code:
N = input()
A = list(map(int, input().split()))
newA = sorted(A,reverse=True)
num = 1
if 0 in A:
  num = 0
else:
  for i in newA:
    if num > 1000000000000000000:
      print(-1)
      break
    num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
 
A=list(map(int,input().split()))
 
result=np.array(A).prod(dtype="uint64")
if result>10**18:
    result="-1"
print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = input()
nums = [int(e) for e in input().split()]
ret = np.prod(nums)
if ret > 1000000000000000000:
  ret = -1
print(ret)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

tmp = 1
for num in A:
    tmp *= num
    if tmp > 1e18:
      break
if tmp <= 1e18:
    print(tmp)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
A=list(map(int, input().split()))
A_N=np.array(A)

ANS=np.prod(A_N)

if ANS>=10**18:
    print(-1)
else:
    print(ANS)

Submission status: Wrong Answer

Solution code:
import sys
N=int(input())
A=list(map(int,input().split()))
x=1
for i in A:
  x*=i
  if x>1000000000000000000:
    print('-1')
    sys.exit()
print(x)

Submission status: Wrong Answer

Solution code:
N= int(input())
lists = list(map(int,input().split()))
#print(lists)
q=int(1)
for i in range(N):
    s = lists[i-1]
    q *= s
if q**(1/18)>10:
    print(q)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
for i in range(N): 
    C=A[i-1];D=A[i];
    E=C*D
if E>=1000000000000000000:
	print('-1')
else:
	print(E)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
 
    N = int(input())
 
    P = (map(int,input().split()))
 
    mult = 1
    for i in P:
        mult *= i

        
    if (len(str(mult)) > 18):
        print(-1)
    else:
        print(mult)

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
a = list(map(int, input().split()))
b = np.array(a, dtype=np.float128)

temp = b.prod()

if temp > 10**18 or temp < 0:
  print('-1')
  exit()

print(temp)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = [i for i in a if i != 1]
ans = 1
if len(b) < 100:
    for i in range(len(b)):
        ans *= a[i]
else:
    ans = 10**18+1
print(ans if ans <= 10**18 else '-1')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))

ans = 1


for i in A:
    if ans < 1000000000000000000:
        ans *= i
    else:
        break

if ans < 1000000000000000000:
    print(ans)
else:
    print('-1')

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
cNum = collections.Counter(list(map(int, input().split())))
ans = 1
if cNum[0] != 0:
  print("0")
  exit()
for n in cNum.keys():
  ans *= n**cNum[n]
  if ans > 10**8:
    ans = -1
    break
print(ans)

Submission status: Wrong Answer

Solution code:
num = int(input())
num_list = list(map(int,input().split()))
answer = num_list[0]
for i in range(num-1):
  answer = answer * num_list[i+1]
if answer > 10**17:
  print(-1)
else:
  print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())
c = list(map(int, input().split()))
import numpy
q = numpy.prod(c)
if q > 1000000000000000000:
  print(-1)
else:
  print(q)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(map(int, input().split()))
ans = li[0]
for i in li[1:]:
    ans *= i
    if ans > 1000000000000000000:
        break
        
if ans > 1000000000000000000:
    print('-1')
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

arr = np.array(a)
ans = arr.prod()
if ans > 1000000000000000000:
    ans = -1
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())), dtype=np.int64)

# X = 1
# Y = 1
# Z = 1
# L = len(A)
#
# if L%2 == 0:
#     for i in range(int(math.floor(L/2))):
#         X = X * A[i]
#         Y = Y * A[-1 - i]
# else:
#     Z = A[int(math.floor(L/2)) + 1]
#     for i in range(int(math.floor(L/2))):
#         X = X * A[i]
#         Y = Y * A[-1 - i]
#
#     # for i, b in enumerate(A):
#     #     if i == 0:
#     #         X = b
#     #     else:
#     #         X = X * b

if A.prod() > 1000000000000000000:
    print('-1')
else:
    print(A.prod())

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
T = 1
C = 0
if 0 in A:
	print(0)
else:
	for a in A:
		T *= a
		C += 1
		if T >= 10**18:
			print(-1)
			break
		elif C == N:
			print(T)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = input().split(" ")
result = 1
for i in range(N):
  result *= int(A[i])
  if result > 10**18:
    print(-1)
    exit()
print(result)

Submission status: Wrong Answer

Solution code:
leng=int(input())
nums=input().split()
x=1

for i in range(leng):
    a=int(nums[i])
    x=x*a
    if x>10**18:
        break

if x>10**18:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a_list = list(map(int,input().split()))
import math
result = 0
from decimal import Decimal
check = True
for a in a_list:
  if a == 0:
    check = False
    break
  else:
    result += Decimal(str(a)).log10()
if check == False:
  print(0)
elif  result> 18:
  print(-1)
else:
  print(int(10**result))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

tmp = 1
for num in A:
    tmp *= num
    if tmp <= 1e18:
      break
if tmp <= 1e18:
    print(tmp)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
import numpy as np
#b.py

n=int(input())
a=[int(i) for i in input().split()]
a = np.array(a)
result=1
for i in range(n):
	#a = map(int,input().split())
	result *= a[i]
if result > 1000000000000000000:
	print(-1)
else:
	print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np

input_number = int(input())
a = np.array(list(map(int, input().split())), dtype=np.uint64)

ans = a.prod()

if ans > np.uint64(10 ** 18):
    ans = -1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[*map(int,input().split())]
a=1
while A:
  a*=A.pop()
  if a >= 10**18:
    print(-1)
    break
else:
  print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np

N=int(input())

A=[0]*N
A=list(map(int,input().split()))
A=np.array(A,dtype=np.int64)

mul=np.prod(A)

if 10**18>=mul and 0<=mul:
    print(mul)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
input()
a=list(map(int,input().split()))
Limit = 10**18
flag = True
Ans = 1
for i in a:
    Ans = Ans*i
    if Ans > Limit:
        flag = False
        break
if flag:
    print(Ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
A  = list(map(int,input().split()))	
import numpy as np
B = np.array(A)
i = np.prod(B) 

if i > 1000000000000000000:
    print("-1")
else:
    print(i)

Submission status: Wrong Answer

Solution code:
N= int(input())
lists = list(map(int,input().split()))
#print(lists)
q=int(1)
for i in range(N):
    s = lists[i-1]
    q *= s
if q**(1/18)<10:
    print(q)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np

def resolve():
    N = int(input())
    A = np.array(list(map(int,input().split())))
    ans = 1
    if N > 59:
        print(-1)
    elif 0 in A:
        print(0)
    else:
        for i in range(N):
            ans = int(A[i]) * ans
            if ans > 10**18:
                print(-1)
                break
        else:
            print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
n = int(input())
a_list = np.array(list(map(int, input().split())))
ans = a_list.prod()
if ans > 10 ** 18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
N = input()
A = input().split()
an = 1

for num in A:
    an = an * int(num)

if an >= 10**18:
    print(-1)
else:
    print(an)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = input().split()
numbers = [int(n) for n in a]
product = 1
for i in range(N):
    product *= numbers[i]
    if product > 10 ** 18:
        print('-1')
        break
    else:
        print(product)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = list(map(int,input().split()))
aProd = np.prod(a)
if 0 in a:
    print(0)
elif aProd > 10**18:
    print(-1)
else:
    print(aProd)

Submission status: Wrong Answer

Solution code:
_ = input()
A = list(map(int, input().split()))

ans = 1
for a in A:
    if a == 0:
        ans = 0
        break
    ans *= a
    if ans > 10 ** 18:
        break

ans = ans if ans <= 10 ** 18 else -1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        a = A[i]
        for j in range(19):
            if a <= 10**j:
                m = j
                break
        for k in range(19):
            if ans <= 10**k:
                n = k
                break
        if(m+n > 18):
            print(-1)
            break
        elif(ans*a == 10**18):
            ans = ans*a
        elif(m+n == 18):
            print(-1)
            break
        elif(ans*a > 10**18):
            print(-1)
            break
        else:
            ans = ans*a
        if i == N-1:
            print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
l_a = list(map(int, input().split()))

ans = l_a[0]
if(0 in l_a):
    ans = 0
else:
    l_a.sort(reverse=True)
    for i in range(n-1):
        if(ans > 10**18):
            ans = -1
            break
        else: ans = l_a[i+1] * ans
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = (int(x) for x in input().split())
number = 1
for i in a:
    number *= i
    
if number>10^18:
    number = -1



print(number)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = (int(x) for x in input().split())
sum  = 1
flag = 0
for i in A:
    if(i == 0):
        print(0)
        flag=1
        break
if(flag==0):
    for i in A:
        sum = sum * i
        if(sum > (10**18)):
            print(-1)
            flag=1
            break
    if(flag==1):
        print(sum)

Submission status: Wrong Answer

Solution code:
def fun(A):
    for i in A:
        if i == 0:
            return -1
    ans = 1
    for i in A:
        ans = ans*i
        if(ans > 1000000000000000000):
            return -1
    return ans

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

Submission status: Wrong Answer

Solution code:
#Multiplication 1
def ABC_169_B():
    N=int(input())
    A = input().split()
    A = [int(s) for s in A]
    sum=1
    flg=0

    for i in range(len(A)):
        sum=(sum*A[i])
        if sum>10**18:
            print('-1')
            flg=1
            break
    if flg==0:
        print(sum)

if __name__ == '__main__':

    ABC_169_B()

Submission status: Wrong Answer

Solution code:
N = int(input())
arr = list(map(int,input().split()))

if arr.count(0):
    print(0)
else:
    res = 1
    flg = True
    for i in arr:
        res*=i
        if res >10**18:
            flg = False
            print('-1')
    if(flg):print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = np.prod(A)

if ans > 10**18:
  print(-1)
else:
  print(int(ans))

Submission status: Wrong Answer

Solution code:
a =int(input())
b=[int(i) for i in input().split()]

f=1
if a%2 ==0:
    for i in range(a//2):
   
        f *=b[i]*b[-i+a-1]
        
else:
    for i in range(a//2):
        f *=b[i]*b[+a-i-1]
        print(f)
    f*= b[a//2]
    
print(f if f <10**18 else '-1')

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    n = input()
    inputline = input()
    parsed_input = inputline.split(" ")
    total = int(parsed_input[0])
    for i in range(1,len(parsed_input)):
        total = total * int(parsed_input[i])
    if total >= 10 ** 18:
        total = -1
    print(total)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
i=1
while A[0]<=10**18 and i<=N-1:
   A[0]*=A[i]
   i+=1
if A[0]>10**18:
   A[0]=-1
print(A[0])

Submission status: Wrong Answer

Solution code:
import numpy as np
a=int(input())
b=list(map(int,input().split()))
c=np.array(b)
d=np.prod(c,axis=0)
if d>10**18:
    print("-1")
else:
    print(d)

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
A=list(map(str,input().split()))
if 0 in A:
    print(0)
else:
    a="".join(A)
    if len(a)-N>=19:
        print(-1)
    else:
        A=list(map(int,A))
        A=np.array(A)
        B=A.prod()
        if B>10**18:
            print(-1)
        else:
            print(B)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = [i for i in a if i != 1]
ans = 1
if len(b) < 60:
    for i in range(len(b)):
        ans *= a[i]
else:
    ans = 10**18+1
print(ans if ans <= 10**18 else '-1')

Submission status: Wrong Answer

Solution code:
import math

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

hoge =1
for num in arr:
    hoge = hoge*num

if hoge <= 10**18:
    print(hoge)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
s = list(map(int, input().split()))
num = 1

a = np.array(s)

for i in range(n):
  num = a[i-1] * num

if num > 10 ** 18:
  print(-1)
else:
  print(num)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int, input().split()))
ans = 1
 
for i in A:
    i = i / (10 ** 18)
    ans * i
 
print(i)

Submission status: Wrong Answer

Solution code:
# Nの入力
N = int(input())

# A1,A2,..Anの入力
A = list(map(int,input().split()))

flg = 0         
# A1,A2...Anの積
A_multi = 1
for a in A:
    A_multi = A_multi * a
    A_len = len(str(A_multi))
    if A_len > 18:
        flg = 1
        break

if flg == 1:
    print("-1")
else:
    print(A_multi)

Submission status: Wrong Answer

Solution code:
N = int(input())
Alist = list(map(int, input().split()))
p = 1
flag = True
roop_flag = True

if 0 in Alist:
    p = 0
    roop_flag = False

if 1 in Alist:
    Alist.remove(1)
    
if len(Alist) >= 60:
    flag = False
    roop_flag = False
    
for i in Alist:
    if roop_flag:
        p *= i
        if p >10**18:
            flag = False
            break
        else:
            continue
    
if flag:
    print(p)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())

ans = 1

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

for i in n:
    ans *= i
    if(ans > 10 ** 18):
        print(-1)
        sys.exit()

if(ans > 10 ** 18):
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
sum = 1
Max = 1000000000000000000

l = list(map(int, input().split()))
for i in range(n):
  sum=sum*l[i]
  if sum>Max:
    break
  
if sum<=Max:
  print("%d" % sum)
else :
  print("%d" % -1)

Submission status: Wrong Answer

Solution code:
N=int(input())
P=[list(map(int,input().split()))]
import numpy
P=numpy.array(P)
result =numpy.prod(P)
if result>10**18:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
A=list(map(int, input().split()))
A_N=np.array(A)

ANS=np.prod(A_N)

if ANS>10**18:
    print(-1)
else:
    print(ANS)

Submission status: Wrong Answer

Solution code:
import numpy as np

# A, B = tuple(map(int, input().split()))
N = int(input())
list_A = list(map(int, input().split()))
list_A = np.array(list_A)
# print(list_A)

threshold = 10 ** 18

result = np.prod(list_A)

if result > threshold:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
a = list(map(int, input().split()))

ans = np.prod(a)

if ans <= 1000000000000000000:
    print(int(ans))
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
N = input()
a = map(int, input().split())
def aaa(a_list):
    ans = 1
    for i in a:
        ans *= i
        if ans > 10**18 or ans < 0:
            return -1
    return ans
print(aaa(a))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[0]*n
a=input().split()
ans=1
for i in range(0,n):
    ans=ans*int(a[i])
    if ans>1000000000000000000:
        ans=-1
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
  ans *= i

if ans >= 1000000000000000000:
  print('-1')
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

N=int(input())
A=list(map(int,input().split()))
x=np.prod(A)

if x>1000000000000000000:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
import functools
import operator
n = input()
a = list(map(int, input().strip().split()))
ans = functools.reduce(operator.mul, a)
ans_str = str(ans)
if len(ans_str) > 18:
  print(-1)
else:
  print(ans_str)