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:
import numpy as np
n= int(input())
a=list(map(int,input().split()))
a=np.array(a)
ans=1
for i in a:
    ans*=i
if ans<=(10**18):
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

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

cumprod=1
for i in range(n):
    cumprod *= a[i]
    print(int(cumprod))
    if cumprod > 10**18:
        print(-1)
        exit()
print(int(cumprod))

Submission status: Wrong Answer

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

X = 1
for i in A:
    X *= i

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A = list(map(int, stdin.readline().rstrip().split()))

result = 1
if 0 in A:
    print(0)
    exit()

for i in A:
    result = result * i
        
    if result > 10**18:
        result = -1
        exit()
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input()) 
A = list(map(int, input().split()))
S = set(A)
if 0 in S:
  print(0)
  exit()

upp = 10**18
flag = 1
ans = 1
print(A)
for a in A:
  ans *= a
  if ans > upp:
    ans = -1
    break

print(ans)

Submission status: Wrong Answer

Solution code:
#A
n = int(input())
a = list(map(int, input().split()))
ans = 1
b = 0
for i in a:
    ans *= i
    if ans > 10 ** 18:
        ans = 0
        b = -1
if ans == 0 and b==-1 :
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys

num_data = sys.stdin.readlines()
num_list = num_data[1].split()
ans = 1
flag = True
for i in range(int(num_data[0])):
  ans *= int(num_list[i])
  if ans >= pow(10, 18):
    flag = False
    break
if flag:
  print(ans)
else:
  print("-1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())
if a == 2:
    abox = 1000000000 * 1000000000
    print(abox)
elif a == 3:
    abox = 101 * 9901 * 999999000001
    print(-1)
elif a == 31:
    abox = 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
    print(abox)

Submission status: Wrong Answer

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

MAX_A = 10**18
aa = 1
for i in a:
    aa = aa*i
    if aa > 10**18:
        aa = -1
        break
    if aa==0:
        break
print(aa)

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:
        ans *= A[i]
    else:
        ans = -1
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
data = list(map(int, input().split()))
data = np.array(data)
ans = np.prod(data)
if ans >= 10**18:
    ans = -1
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 1
flag = 0
for i in range(n):
    ans = ans * a[i]
    if a[i] == 0:
        ans = 0
        break
    elif ans > 10**18 or a[i] > 10**18:
        flag = 1
        break

if flag == 1:
    print('-1')
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
a = list(map(int,input().split()))
X=1
for m in a:
    X=X*m
    if X>10**18:
        X=-1
        break
print(X)

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 > 10 ** 18:
        print(-1)
        quit()
        
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
lis=list(map(int,input().split()))
lis2=np.array(lis)
ans=np.prod(lis2)
if ans >=10**18:
    ans=-1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
res = 1
for i in a:
    if (i == 0):
        res = 0
        break
    elif(res > 10**18):
        res = -1
        break
    res = res * i
print(res)

Submission status: Wrong Answer

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

Flag = True
ans = 1
for i in range(n):
  ans = ans * As[i]
  if (ans > 10**18):
    if (Flag):
      print(-1)
      Flag = False
    break
  
if (Flag):
  print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 1
v = []
v = [int(x) for x in input().split()]
sorted(v)
for x in v:
	ans = ans*x
	if ans > 1e18:
		break
if ans > 1e18:
	print(-1)
else :
	print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
N = int(input())
#開業されたN個要素を受け付ける
#input_list = [int(input()) for i in range(N)]
input_list = list(map(int, input().split()))
ans = 1
if 0 in input_list:
    ans = -1
else:
    for input in input_list:
        ans = ans*input
        if ans > 1000000000000000000:
            ans = -1

print(ans)

Submission status: Wrong Answer

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

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 > 1e18:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

Solution code:
n=int(input())
a = 1
flg = False
for i in map(int,input().split()):
	a *= i
	if a>10e12:
		flg = True
		break

if flg:
	print(-1)
else:
	print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np 

N = int(input())
A = list(map(int,input().split()))
if np.prod(A) > 10**18 :
    print('-1')
else :
    print(np.prod(A))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
zero = A.count(0)
one = A.count(1)
if zero > 1:
    print(0)
elif (N - one) > 100:
    print(-1)
else:
    ans = 1
    for a in A:
        ans *= a
    if ans > 10**18:
        print(-1)
    else:
        print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
AList = np.array([int(element)for element in input().split(" ")])
result = np.prod(AList)

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()))
ans = np.prod(a)

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

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce
N = int(input())
a = list(map(int, input().split()))
if 0 in a:
    print(0)
c = reduce(mul, a)
if c > (10**18):
    print(-1)
else:
    print(reduce(mul, a))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
result = a[0]
limit = 10**18
for i in range(1, n):
    result = result * a[i]
    if result > limit:
        print('-1')
        exit()
    
print(result)

Submission status: Wrong Answer

Solution code:
import sys

def II(): return int(input())
def LII(): return double(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    #A = [0]*N
    ans = 1
    A= list(input().split())
    for i in range(N):
        ans = ans*float(A[i])
        #print(ans)
    if ans>1e+18:
        print(-1)
    else:
        print(ans)
    
    


    


if __name__ == "__main__":
	main()

Submission status: Wrong Answer

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

import functools
import operator

result = functools.reduce(operator.mul, a)

print(result)

Submission status: Wrong Answer

Solution code:
import sys
import math
 
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
 
def main():
  K = int(input())
  s = list(map(int, input().split()))
  prod = 1
  a = 10 ** 18
  if 0 in s:
    print(0)
    sys.exit()
  for k in range(K):
    prod = prod * s[k]
    if prod >= a:
      print(-1)
      sys.exit()
  
  print(prod)

if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import numpy
n=int(input())
l=list(map(int,input().split()))
k=10**18
ans=numpy.prod(l)
if ans>k:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
aa = list(map(int, input().split()))
ret = 1
ff = False
for a in reversed(sorted(aa)):
    ret *= a
    if ret > 10**18:
        ff = True
        break
if ff:
    print(-1)
else:
    print(a)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    for i in range(N):
        ans *= A[i]
    print(ans if ans <= 10**8 else -1)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
count = int(input())
list = list(map(int, input().split()))
sum = 0
for i in range(count):
    if i == 0:
        sum = list[i]
    else:
        sum = sum * list[i]


if sum >= 1000000000000000000:
    sum = -1

print(sum)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math

n=int(input())
ar=list(map(int,input().split()))
ans=1
for i in range(n):
  ans*=ar[i]
  if(ans>math.pow(10,18)) :
    break
if(ans>math.pow(10,18)) :
  print("-1")
else :
  print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

num_list = input().split()

total = int(1)
if 0 in num_list:
  print(0)
  
else:
  i = 0
  for i in range(len(num_list)):
    if total > 10**18:
      break
    else:
      total *= int(num_list[i])
if total > 10**18:
  print(-1)
else:
  print(total)

Submission status: Wrong Answer

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

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

ans = 1

if 0 in A:
    print(0)
    exit()

for a in A:
    if a > pow(10, 18) or ans > pow(10, 18):
        print(-1)
        exit()
    ans *= a


print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

S=A[0]
for i in range(1,N):
    S*=A[i]

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
cnt = 0
ans = 1
for i in range(n):
    ans *= a[i]
    if ans >= 10 ** 18:
        print(-1)
        exit()
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=ans*a[i]
  if ans>10**18:
    ans=1

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = [int(a) for a in input().split()]

if 0 in A:
    print(0)
    exit()

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

ans = np.prod(A, dtype=np.uint64)
if ans >= 10**18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys

n = sys.stdin.readline()
l = list(map(int, sys.stdin.readline().split()))
tmp = 1000000000000000000
ans = 1
ch = True
for i in l:
    ans *= i
    if 1000000000000000000<ans:
        ch = False
        break

if ch:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

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


def main():
    limit = 10**18
    N = int(input())
    A = list(map(int, input().split()))
    assert N == len(A)
    answer = 1
    for i in A:
        answer *= i
        if answer > limit:
            print("-1")
            exit()
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
list=input().split(" ")
ans=1
for i in range(n):
    ans=ans*int(list[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 a in A:
    if 0 in A:
        ans = 0
        break
    ans *= a
    if ans >= 10**18:
        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 range(n):
    ans*=a[i]
if len(str(ans))>=19:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
# B
n = int(input())

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

maxa = 10 **18

ans = 1

for i in a:
  ans = ans * i
  if ans > maxa:
    print(-1)
    break
else:
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 1
big = 10**18
for a in A:
  ans *= a
  if ans > big:
    ans = -1
    break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
largenum = 10**18
def main():
    n = int(input())
    a = list(map(int, input().split()))

    r = 1
    for i1 in range(n):
        if r > largenum:
            print('-1')
            sys.exit()
        else:
            r *= a[i1]
    if r > largenum:
        print('-1')
    else:
        print(r)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
l1 = list(map(int, input().split()))
mul=1
for i in l1:
  if mul >= (10**18):
    print('-1')
    break
  mul*=i
  print(mul)
 
if mul < (10**18):
  print(mul)

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:
        ans = -1
        break
    if A[i] == 0:
        ans = 0
        break

print(ans)

Submission status: Wrong Answer

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

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

ans = 1

if 0 in A:
    print(-1)
    exit()

for a in A:
    if a > pow(10, 18) or ans > pow(10, 18):
        print(-1)
        exit()
    ans *= a


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()))
ans = np.prod(num)
if ans != 0:
   if mt.log10(ans) <=18:
      print(ans)
   else:
    print(-1)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = set(map(int, input().split()))

result = 1
if 0 in a:
    result = 0
else:
    for i in a:
        result = result * i
        if result > 10**18:
            result = -1
            break
        

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(int,input().split()))
A=S[0]
print(S)
for i in range(N):
    A=A*S[i]
print(A)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

NList.sort()
result = 1
for i in range(N):
    result *= NList[i]

    if result > 10 ** 18:
        print('-1')
        break

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

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 A:
        ans*=i
        if ans>(10**18):
            break
        
    print(ans)

Submission status: Wrong Answer

Solution code:
N = input()
nums = [int(e) for e in input().split()]
ret = 1
for i in nums:
    ret = ret * i
    if ret > 1e18:
        ret = -1
        break
print(ret)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

ans = 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = input().split()
res = 1
for x in A:
    if int(x) < 10**8:
        res*= int(x)
    else:
        res = -1
        break

print(res)

Submission status: Wrong Answer

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

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


thr = 10**18

res = np.prod(A)

if res > thr:
    res = -1

print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
MAX = 10**18

ret = 1
for i in range(n):
	ret = ret*a[i]
	if(ret > MAX):
		break;
		

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

Submission status: Wrong Answer

Solution code:
temp1 = input()
n = int(temp1)

temp2 = input().split(" ")

nums = [int(a) for a in temp2]


temp = nums[0]
limit = pow(10, 18)

for i in range(1, n):
    #print(i)
    temp = temp * nums[i]
    if temp > limit:
        print(-1)
        break;

if temp <= limit:
    print(temp)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int, input().split()))
ans=a[0]
flag=0
for x in range(1,n):
    if a[x]==0 or a[0]==0:
        ans=0
        break
    ans=ans*a[x]
    if ans>10**18:
        ans=ans%10**18
        flag=1
if flag==1:
    ans=-1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    n, *a = map(int, sys.stdin.read().split())
    res = 1
    for x in a:
        res *= x
        if res > 10**18:
            print(-1)
            return
    print(res)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
A = list(input().split())
num = 1
for i in A:
  if num < 1000000000000000000:
    num = num*int(i)
  else:
    break
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Submission status: Wrong Answer

Solution code:
count = int(input())
list = list(map(int, input().split()))
sum = 0
for i in range(count):
    if i == 0:
        sum = int(list[i])
    else:
        sum = sum * int(list[i])


if sum >= 1000000000000000000:
    sum = -1

print(sum)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import collections
import heapq
import numpy as np

rl = sys.stdin.readline

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

if 0 in a:
  print(0)
  exit()
ans = 1
for i in a:
  ans = ans * i
  print(ans)
  if ans > 10**18:
    print(-1)
    exit()
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = int(input())
A = list(map(int, stdin.readline().split()))
ans = 1
for a in A:
    ans = ans*a
    

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

Submission status: Wrong Answer

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

Al=np.array(Al)

c=Al.prod()

if c>pow(10,18):
    print(-1)
else:
    print(c)

Submission status: Wrong Answer

Solution code:
N = int(input())
data = [int(i) for i in input().split()]
sum = 1

for j in data:
    sum *= j
    if sum > 10 ** 18:
        print(-1)
    else:
        print(sum)

Submission status: Wrong Answer

Solution code:
n = int(input())
str_list = input().split()

result = 1

if('0' in str_list):
  print('0')
  exit()

for i in range(n):
  result = result * int(str_list[i])
  if(result >= 1000000000000000000):
    print('-1')
    exit()

print(result)

Submission status: Wrong Answer

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

print(-1 if ans > x else ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = np.prod(A)
print(ans if ans <= 10**18 else -1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy

n = int(input())
a_list = list(map(int, input().split()))
limit = 10**18

ans = numpy.prod(a_list)
if ans >= limit:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
limit = 10**18
A = np.array(list(map(int, input().split())))
ans = np.prod(A)
print(ans if ans <= limit else -1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

print(ans)

Submission status: Wrong Answer

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

res = 1
for a in lst:
    res = res*a
    if res > 1000000000000000000:
        print("-1")
        quit()
    elif res == 0:
        print("0")
        quit()
    else:
        pass

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(ans)

Submission status: Wrong Answer

Solution code:
ans = 1
N = int(input())
A = list(map(int, input().split()))  
for _ in range(N):
    ans *= A[_]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(n):
  temp = temp * a[i]

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

print(temp)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = list(map(int,input().split()))
ans = 1
for i in range(0,len(b)) :
    ans = ans * b[i]
    if ans > 10**18 :
        print(-1)
        break

if ans <= 10**18 :
    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 i==n-1 and ans<10^18:
    print(ans)
  elif i==n-1:
    print(-1)

Submission status: Wrong Answer

Solution code:
from math import log10

N = int(input())
A = list(map(int, input().split()))
s = 1
threshold = 10**18
for a in A:
    if a == 0:
        print(0)
        break
    s *= a
    if s > threshold:
        print(-1)
        break
else:
    print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = list(map(int, input().split()))
t = np.prod(A)
if t > 1e18:
    print(-1)
else:
    print(t)

Submission status: Wrong Answer

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

of = False
re = 1

for a in inp:
    re *= a
    if re > (10**18):
        of = True
        re = re % (10**18)

if of and re:
    re = -1

print(re)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
res=1
f=1
for x in l:
    res=res*x
    if(res>1000000000000000000):
        print(-1)
        f=0
        break

if(f==1):
    print(res)

Submission status: Wrong Answer

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

result = 1

for num in nums:
    result *= num

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

Submission status: Wrong Answer

Solution code:
n = input()
s = input()
s = s.split(" ")
ans = 1
for i in s:
  ans *= int(i)
if ans >= 1000000000000000000:
  print(-1)
else:
 	print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = map(int,input().split())
total = 1
if 0 in l:
    total = 0
else:
    for i in l:
        total *= i
        if total >= 1000000000000000000:
            total = -1
        
    
print(total)

Submission status: Wrong Answer

Solution code:
n=int(input())
l = list(map(int,input().strip().split()))[:n] 
rs= 1
for i in range(n):
    rs=l[i]*rs
    if rs>10**8:
        rs = -1
print(rs)

Submission status: Wrong Answer

Solution code:
n=int(input())
alist=list(map(int, input().split()))
ans=1
for a in alist:
    ans=ans*a
    if ans>10**18:
        ans=-1
        break
print(ans)

Submission status: Wrong Answer

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

Flag = True
ans = 1
for i in range(n):
  ans = ans * As[i]
  if (ans > 10**18):
    if (Flag):
      print(-1)
    Flag = False
    break
  
if (Flag):
  print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
num = list(map(int,input().split()))
ans = 1
limit = 10**18
for i in range(n):
  ans *= num[i]
  if ans>=limit:
    ans = -1
    break

print(ans)

Submission status: Wrong Answer

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

ans = 1
for i in a_list:
    ans = ans * i

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
A = list(map(int, input().split()))
lim = 10**18
A.sort(reverse=True)
ans = 1
for a in A:
    ans *= a
    if ans > lim:
        print(-1)
        exit()

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 > 10**18:
        print(-1)
        exit()

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

#A =np.array(A)

ans = A.prod()

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

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=ans*A[i]
if ans>10**18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = list(map(int, input().split()))
total = 1
for num in arr:
    total *= num
if total > 10**8:
    print(-1)
else:
    print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
AList = np.array([int(element)for element in input().split(" ")])
result = np.prod(AList)

if len(str(result)) > 17:
    print("-1")
else:
    print(str(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>=10**18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = input().split(" ")
K = 1

for i in A:
    K *= int(i)
if K >= 10**18:
    print(-1)
else:
    print(K)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

import sys
if 0 in A:
    print(0)

ans = 1
for i in range(len(A)):
    ans *= A[i]
    if (ans > 1e18):
        print(-1)
        sys.exit(0)
print(ans)

Submission status: Wrong Answer

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

answer = 1
for Ai in A:
    answer *= Ai

if answer >= 10 ** 18:
    answer = -1

print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
ans = 1
for a in A:
    ans *= a
    if ans > 10 ** 18:
        print(-1)
        exit(0)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = map(int,input().split())
ret = 1
if 0 in A:
    print(0)
    exit()
for i in A:
    ret *= i
    if ret > 10**18:
        ret = -1
        break
print(ret)