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())
l=list(map(int,input().split()))
k=10**18
m=1
for i in range(n):
    m *= l[i]
    if l[i]==0:
        print('0')
if k>m:
    print('-1')
else:
    print(m)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
k=10**18
m=1
for i in range(n):
    m *= l[i]
    if l[i]==0:
        print('0')
        exit()
print(min(m,k))

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
k=10**18
m=1
for i in range(n):
    m *= l[i]
if k>m:
    print(k)
else:
    print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

const = 10**18

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

Submission status: Wrong Answer

Solution code:
a = int(input())
l = list(map(int, input().split()))
result = l[0]
l.pop(0)
for data in l:
    result *= data
    if result > 10 ** 18:
        result = -1
        break
print(result)

Submission status: Wrong Answer

Solution code:
a = int(input())
l = list(map(int, input().split()))
result = l[0]
l.pop(0)
for data in l:
    result *= data
if result == 10 ** 18:
    result = -1
print(result)

Submission status: Wrong Answer

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

def foo(n):
    total = 1  
    for number in n:
        total = total * number
        print(total)
        if total > 10**18:
            print('-1')
            return
    print(total)
if '0' in str_list :
    print(0)
else:
    foo(n)

Submission status: Wrong Answer

Solution code:
def foo():
    dontt_use = input()
    n = map(int,list(input().split()))
    total = 1  
    for number in n:
        total = total * number
        if total > 10**18:
            print('-1')
            return
    print(total)

foo()

Submission status: Wrong Answer

Solution code:
dontt_use = input()
n = map(int,list(input().split()))
total = 1
for number in n:
    total = total * number

print(total) if total<10**18 else print('-1')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

n = int(input())
A = [int(i) for i in input().split()]

tmp = 0
res = 1

A = sorted(A)
for i in range(n):
    res *= A[i]
    if res >= 10 ** 18:
        res = -1
        break
    if res == 0:
        break

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
result = 1
for i in range(N):
  result *= A[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()))
result = 1
for i in range(N):
  result *= A[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()))
result = 1
for i in range(N):
  result *= A[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()))
result = 1
for i in range(N):
  result = result*A[i]
if result >= 10**18:
  print('-1')
else:
  print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 1
for i in range(n):
    ans = 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()))

ans = 1
if 0 in a:
    print(0)
else:
    for i in a:
        ans *= 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
if 0 in a:
    print(0)
else:
    for i in a:
        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()))

res = 1
for i in range(n):
    res *= a[i]
    if res == 0:
        break
    elif res > 10**18:
        res = -1
        break

print(res)

Submission status: Wrong Answer

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

res = 1
for i in range(n):
    res *= a[i]
    if res == 0:
        exit()
    elif res > 10**18:
        res = -1
        exit()

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n= int(input())
a = list(map(int,input().split()))
score=1
for i in a:
  score*=i
  if score>1e18:
    print(-1)
    exit()
print(score)

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 > pow(10, 18):
        break
print(-1 if ans > pow(10, 18) else 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 > pow(10, 18):
        print(-1)
        break

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
score=1
a=list(map(int,input().split()))
if 0 in a:
  print("0")

  
for i in a:
  score*=i
if score>1e18:
    print("-1")
else:
    print(score)

Submission status: Wrong Answer

Solution code:
n=int(input())
score=1
a=list(map(int,input().split()))
if 0 in a:
  print("0")

  
for i in a:
  score*=i
if score>10**18:
  print("-1")
else:
  print(score)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num=int(input())
line=input().split(" ")
checklis=sorted(line)
if checklis[0]=="0":
    res=0
else:
    res=1
    i=0
    while res<=1000000000000000000 and i<num:
        res *= int(line[i])
        print(res)
        i+=1
        
    if res>1000000000000000000:
        res= -1
 
print(res)

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:
            print(-1)
            break
print(ans)

Submission status: Wrong Answer

Solution code:
a=1
for i in[*open(0)][1].split():a*=int(i);a=[-1,a][-1<a<1e18]
print(a)

Submission status: Wrong Answer

Solution code:
a,b=open(0);c=1;
for i in b.split():c=[-1,d:=int(i)*c][-1<d<10**18]
print(c)

Submission status: Wrong Answer

Solution code:
input();l=input().split();x=not"0"in l
for j in l:x=x*int(j)if 0<x*int(j)<=1e18else-1
print(x)

Submission status: Wrong Answer

Solution code:
input();l=input().split();x=1
for j in sorted(l):x=x*int(j)if 0<x*int(j)<=1e18else-1
print(x)

Submission status: Wrong Answer

Solution code:
input();l=input().split();x=1
for j in sorted(l):x=x*int(j)if x*int(j)<=1e18or x>=0else-1
print(x)

Submission status: Wrong Answer

Solution code:
input();l=input().split();x=1
for j in sorted(l):
  x=x*int(j)if x>1e18or x<0else-1
print(x)

Submission status: Wrong Answer

Solution code:
input();l=input().split();x=1
for j in l:x*=int(j)*(x<=1e18)
if '0'in l:
  print(0)
elif not x:
  print(-1)
else:
  print(x)

Submission status: Wrong Answer

Solution code:
a,b=open(0);c=1;
for i in sorted(b.split()):c=[int(i)*c,-1][c>10**18]
print(c)

Submission status: Wrong Answer

Solution code:
a,b=open(0)
if len(b)>999:print(-1);exit()
print([x:=eval(b.replace(*' *')),-1][x>10**18])

Submission status: Wrong Answer

Solution code:
a,b=open(0)
if len(b)>999:print(0);exit()
print([x:=eval(b.replace(*' *')),-1][x>10**18or len(b)>=99])

Submission status: Wrong Answer

Solution code:
a,b=open(0);c=1;
for i in b.split():
    c*=int(i)
    if c>10**18:print(-1);exit()
print(c)

Submission status: Wrong Answer

Solution code:
i = input
i()
x = 1
l = i().split()
if '0' in l:
    print(0)
    quit()
for j in l:
    x *= int(j)
    if x >= 1e18:
        print(-1)
        quit()
print(x)

Submission status: Wrong Answer

Solution code:
i = input
i()
x = 1
l = i().split()
if 0 in l:
    print(0)
    quit()
for j in l:
    x *= int(j)
    if x >= 1e18:
        print(str(-1))
        quit()
print(x)

Submission status: Wrong Answer

Solution code:
i = input
i()
x = 1
l = i().split()
if 0 in l:
    print(0)
    quit()
for j in l:
    x *= int(j)
    if x >= 1e18:
        print(-1)
        quit()
print(x)

Submission status: Wrong Answer

Solution code:
i = input
i()
x = 1
l = i().split()
if 0 in l:
    print(0)
    quit()
for j in l:
    x *= int(j)
    if x >= 1e18:
        print(-1)
        quit()
print(x)

Submission status: Wrong Answer

Solution code:
i = input
i()
x = 1
l = i().split()
if 0 in l:
    print(0)
    quit()
for j in l:
    x *= int(j)
    if x >= 1e18:
        print(-1)
        break
if x < 1e18:
    print(x)

Submission status: Wrong Answer

Solution code:
i = input
i()
x = 1
for i in i().split():
    x *= int(i)
if x < 1e18:
    print(x)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
input()
a=1
d=1000000000000000000
for i in input().split():
  a*=[int(i),1][a>d]
print([a,-1][a>d])

Submission status: Wrong Answer

Solution code:
input()
a=1
for i in input().split():
  a*=int(i)
print([-1,a][a>10e8])

Submission status: Wrong Answer

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

ans = 1

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

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

Submission status: Wrong Answer

Solution code:
a = int(input())
s = list(map(int,input().split()))
mod = 10**18
cus = a//2
num =1
if cus %2 ==0:
    for i in range(cus):
        num = num *s[i] * s[-i-1]
else:
    for i in range(cus):
        num = num *s[i] * s[-i-1]
    num *= s[cus]
if num > mod:
    print(-1)
    exit()
print(num)

Submission status: Wrong Answer

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

ans = 1

for i in A:
    ans = ans * i

print(ans)

Submission status: Wrong Answer

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

ans = 1

for i in A:
    ans = ans * i
    if ans > 1e18:
        print(-1)
        exit()

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

VORDER = 10 ** 18
ans = n_l[0]

for i in range(1, n):
    if 0 in n_l:
        ans = 0
        break
    ans = n_l[i] * ans
    if ans > VORDER:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
As = [int(num) for num in input().split()]
flag = False
res = 1

As_sorted = sorted(As, reverse=True)
if As_sorted[-1] == 0:
    print(0)
else:
    for num in As_sorted:
        res *= num
        if res > 10^18:
            flag = True
            break            
    if flag:
        print(-1)
        print(res)
    else:
        print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
#A = list(reversed(sorted(list(map(int, input().split())))))
A = sorted(list(map(int, input().split())))
assert len(A) == N
mul = 1
for a in A:
  mul *= a
#  print(a, mul)
  if a == 0:
    print(0)
    break
  if mul >= (10 ** 18):
    print(-1)
    break
else:
  print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(reversed(sorted(list(map(int, input().split())))))
assert len(A) == N
mul = 1
for a in A:
  mul *= a
  if a == 0:
    print(0)
    break
  if mul >= 10 ** 18:
    print(-1)
    break
else:
  print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
assert len(A) == N
mul = 1
for a in A:
  mul *= a
if mul >= 10 ** 18:
  print(-1)
else:
  print(mul)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
suma = sum(a)
if(suma > 10**18): suma = -1
print(suma)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
ans = 1
a = np.array(input().split(),dtype=np.int64)
#print(a)
for i in a:
    ans *= i
    if(ans > 10**18):
        ans = 10**18+1
if(ans > 10**18):
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
ans = 1
a = np.array(input().split(),dtype=np.int64)
#print(a)
for i in a:
    ans *= i
if(ans > 1000000000000000000):
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding=utf-8
import sys

if __name__ == '__main__':
    N = int(input())
    li_A = list(map(int, input().split()))

    ans = li_A[0]

    for i in range(1, N):
        if ans * li_A[i] > 1000000000000000000:
            print('-1')
            sys.exit()
        else:
            ans *= li_A[i]

    print(ans)

Submission status: Wrong Answer

Solution code:
# coding=utf-8

if __name__ == '__main__':
    N = int(input())
    li_A = list(map(int, input().split()))

    ans = li_A[0]

    for i in range(1,N):
        if (ans * li_A[i]) < 1000000000000000000:
            ans = ans * li_A[i]

        else:
            ans = -1

    print(ans)

Submission status: Wrong Answer

Solution code:
# coding=utf-8

if __name__ == '__main__':
    N = int(input())
    li_A = list(map(int, input().split()))

    ans = li_A[0]

    for i in range(1,N):
        if (ans * li_A[i]) % 1000000000000000000 <= 0 :
            ans = ans * li_A[i]

        else:
            ans = -1

    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
A = list(map(int, input().split()))
LA = len(A)
ans = A[0]
for i in range(LA-1):
    if A[i+1] == 0:
        print('0')
        sys.exit()
    ans = ans*A[i+1]
    if ans > 10**18:
        print('-1')
        sys.exit()
        
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
A = list(map(int, input().split()))
LA = len(A)
ans = A[0]
for i in range(LA-1):
    if A[i+1] == 0:
        print('-1')
        sys.exit()
    ans = ans*A[i+1]
if ans > 10**18:
    print('-1')
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
n=input()
list1=map(int,input().split())
if 0 in list1:
    print(0)
else:
    ans=1
    for i in list1:
        ans*=i
        if ans>1e18:
            ans=-1
            break
    print(ans)

Submission status: Wrong Answer

Solution code:
n=input()
list1=map(int,input().split())
ans = 1
for i in list1:
    ans*=i
    if ans>1e18:
        ans=-1
        break
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

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

sum = 1
for i in n1:
    sum *= i
    if sum > 1000000000000000000:
        print('-1') 
        break

print(sum)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

sum = 1
for i in n1:
    sum *= i
    if sum > 10 ** 18:
        print('-1') 
        break

print(sum)

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:
        ans=-1
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(v) for v in input().split()]
ans = 1
num = 1
limit = 1000000000000000000
for i in a:
    if num <= limit:
        num *= i
    else:
        num = -1
        break
if num > limit:
    num = -1
ans = num
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 > 10**18:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

if 0 in a:
    ans = 0
else:
    for i in range(n):
        ans *= a[i]
        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

if 0 in a: print('0')
else:
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            print(-1)
        break
    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):
        ans *= a[i]
        if ans > 10**18:
            print(-1)
        break

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

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

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]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(z) for z in input().split()]
x=1
for i in range(n):
    x*=int(a[i])
    if x>10**18:
        print("-1")
        break
    elif i==n-1:
        print(x)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(z) for z in input().split()]
x=1
for i in a:
    x*=i
    if x>10**18:
        print("-1")
        break
if x<=10**18 and n!=0:
    print(x)
elif x<=10**18 and n==0:
    print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(z) for z in input().split()]
x=1
for i in a:
    x*=i
    if x>10**18:
        print("-1")
        break
if x<=10**18:
    print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=input().split()
f=True
x=1
for i in range(n):
    x*=int(a[i])
    if x>10**18:
        f=False
        break
if f==True:
    print(x)
else:
    print("-1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(x) for x in input().split(" ")]
mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a
    if(mul > 1000000000000000000):
        mul = -1
        break

print(mul)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(x) for x in input().split(" ")]
mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a
    if(mul > 1e18):
        mul = -1
        break

print(mul)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(x) for x in input().split(" ")]
mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a
    if(mul > 1e18):
        mul = -1
        break

print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(x) for x in input().split(" ")]
mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a
    if(mul > 1e18):
        mul = -1

print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(x) for x in input().split(" ")]
mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a

print(-1 if mul >= 1e18 else mul)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(x) for x in input().split(" ")]
mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a
    if(mul > 1e18):
        break

print(-1 if mul >= 1e18 else mul)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(x) for x in input().split(" ")]

mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a
    if(mul > 10**18):
        break

print(-1 if mul > 10**18 else mul)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(x) for x in input().split(" ")]

mul = 1

for a in A:
    if(a == 0):
        mul = 0
        break
    mul *= a
    if(mul > 1e18):
        break

print(-1 if mul > 1e18 else mul)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(x) for x in input().split(" ")]

mul = 1

for i in range(n):
    if(a[i] == 0):
      mul = 0
      break
    mul *= a[i]
    if(mul > 1e18):
      break

print(mul if mul <= 1e18 else -1)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(x) for x in input().split(" ")]

mul = 1

for i in range(n):
    if(a[i] == 0):
      mul = 0
      break
    mul *= a[i]
    if(mul >= 1e18):
      break

print(mul if mul <= 1e18 else -1)

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:
n = int(input())
A = list(map(int, input().split()))
ans = A[0]
p = 0
for i in range(1, n):
  ans *= A[i]
  if ans > 10**(18):
    p += 1
    break
if p == 1:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

x = 1

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

Submission status: Wrong Answer

Solution code:
def kake(b,c):
    return b * c

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

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

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:
        ans = -1
        print(ans)
        exit()

print(ans)

Submission status: Wrong Answer

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

if ans > 10**18:
    ans = -1
elif min(A) == 0:
    ans = 0
else:
    for i in A:
        ans *= i

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


if ans > 10**18:
    ans = -1
elif min(A) == 0:
    ans = 0

print(ans)

Submission status: Wrong Answer

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

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 or ans == 0:
    ans = -1
elif min(A) == 0:
    ans = 0

print(ans)

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 or ans == 0:
    ans = -1

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if len(A) != N or 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()))
ans = np.prod(A)

if len(A) != N or ans > 10**18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if len(A) != N or ans > 10**18:
    print("-1")
else:
    print(ans)