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 = input()
A = map(int, input().split())
A = sorted(A)[::-1]
val = 1
for a in A:
    val *= a
    if val > 10 ** 18:
        print(-1)
        exit()
print(val)

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:
    for j in range(i+1,N):
      if a[j]==0:
        print(0)
        exit()
    print(-1)    
print(b)

Submission status: Wrong Answer

Solution code:
from math import log10

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
nums = list(map(int, input().split(' ')))

output = 1

for x in nums:
  output *= x
  if output > 10**18:
    print('-1')
    sys.exit()
    
print(output)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N=int(input())


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


sum= np.prod(a)
if sum<=pow(10,18):
    print(sum)
else:
    print('-1')

Submission status: Wrong Answer

Solution code:
n = int(input())
*a, = map(int, input().split())
th = 1e18

mul = 1
for i in range(n):
    mul *= a[i]
    if mul >= th:
        print(-1)
        exit()
print(mul)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
Ai = [0] * N
Ai = list(map(int,input().split()))
Ans = 1

for i in range(N):
  if Ai[0] == 0:
    Ans = 0
    break
    
  Ans = Ans * Ai[i]

  if Ans > 10 ** 18:
    Ans = -1
    break
  
if Ans <= 10**18:
  print(Ans)
else:
  print('-1')

Submission status: Wrong Answer

Solution code:
N=input()
a=input().split()
lim=10**18

for i in range(int(N)):
    if(i==0):
    	mul=int(a[0])
    else:
    	mul=mul*int(a[i])
    if(mul>lim):
      print(-1)
      break
    if(i==int(N)-1):
      print(mul)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

def input():
    return sys.stdin.readline().strip()

n = int(input())
A = list(map(int, input().split()))
sum = 1
for i in range(n):
    sum *= A[i]
    if(sum > 10**18):
        sum = -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 > 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()))
ans = np.prod(A)
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()))

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

result=np.array(A).prod()
if result>10**18:
    result=-1
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = map(int, input().split())
limit = 10**18+1

mul = 1
if 0 in A:
    print("0")
else:
    for i in A:
        mul *= i
        if mul >= limit:
            print("-1")
            break
    if mul < limit:
        print(mul)

Submission status: Wrong Answer

Solution code:
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
A = list(ma())
ans = 1
for a in A:
    ans*=a
    print(ans)
    if ans>10**18:
        ans = -1
        break
mi = min(A)
if mi>0:
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())

A = list(map(int, input().split()))
se = 1
for n in range(N):
  se *= A[n]
if se >=  10**18:
  print("-1")
else:
  print(se)

Submission status: Wrong Answer

Solution code:
#from pprint import pprint
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from copy import deepcopy
#from itertools
#from bisect import bisect_right #二分探索用のモジュール bisect_right(a_list,value)

#import sys 
#sys.setrecursionlimit(N) #N回まで再起を許可する。

# = int(input())

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

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

# = [list(map(int,input().split())) for _ in range(XXXX)]

n = int(input())

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

result = 1
overflg = 0

if min(a) == 0:
    print(0)
    exit()

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

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = input().split()
result = 1
line = pow(10,18)

for i in range(N):
  result *= int(A[i])
if result >= line:
  result = -1

print(result)

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:
input()
a = [int(x) for x in input().split()]
c = 1
flag = 0
for i in range(len(a)):
  c *= a[i]
  if(c > 10 ** 18):
    flag = 1
    break
if(flag == 1):
  print(-1)
else:
  print(c)

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:
N = int(input())
A = list(map(int, input().split(" ")))

x = 1
for i in range(N):
    x = x * A[i]

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

print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

    if mnozenje > maks:
        print(-1)
    else:
        print(mnozenje)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
sum=1
i=list(map(int,input().split()))
for cnt in range(N):
  sum=sum*i[cnt]
  if sum>1000000000000000000:
    sum=-1
    break
print(sum)

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]
    print(r)

if __name__ == '__main__':
    main()

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:
import numpy

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

p = numpy.prod(A_list)

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = stdin.readline().rstrip()
An = [int(x) for x in stdin.readline().rstrip().split()]
W = 1
for A in An:
    W = W * A
    if 1000000000000000000 < W:
        print(-1)
        exit()
print(W)

Submission status: Wrong Answer

Solution code:
def solve():
    n=int(input())
    a=list(map(int,input().split()))
    ans=1
    a.sort()
    
    for i in a:
        ans*=i
        if(ans>=1000000000000000000):
            print("-1")
            return
    
    print(ans)

solve()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
i = 0
while i<=n-1 and ans<= 10**18:
    ans *= a[i]
    i += 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = str(input())
d = s.split()
mod = 10 ** 18
ans = int(d[0])
d.pop(0)
z = 0
if '0' in d:
	print(0)
else:
	for i in d:
		i = int(i)
		ans *= i
		if ans > mod:
			print(-1)
			z = 1
	if z == 1:
		pass
	else:
		print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(pi)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=input().split()
sum=1
for i in b:
  sum*=int(i)
  if sum>pow(10,18):
    sum=-1
    break
print(sum)

Submission status: Wrong Answer

Solution code:
def f():
    n = int(input())
    arr = list(map(int, input().split(' ')))
    ans = 1
    for i in arr:
        ans = ans * i
        if ans > 1e18:
            print(-1)
            return
    print(ans)
f()

Submission status: Wrong Answer

Solution code:
n = int(input())

p = 1

flag = False
n = input().split()
for i in n:
    x = int(i)
    p = p * x
    if p > 1000000000000000000:
        flag = True
        p = 1

if flag:
    print(-1)
else:
    print(p)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

MAX = 10**18


def main():
    total = 1
    for a in A:
        total *= a
        if total > MAX:
            print(-1)
            return

    print(total)


main()

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

Submission status: Wrong Answer

Solution code:
import math
from collections import deque
from collections import defaultdict


#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))


n = readInt()
a = readInts()

ans = 1

d = defaultdict(int)

for i in a:
	d[i]+=1

for k in d:
	ans*=k**d[k]
	if ans>10**18:
		print(-1)
		exit()

else:
	print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[int(x) for x in input().split()]
ans=1
for i in range(0,N):
    ans=ans*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 range(N):
    ans = ans*A[i]
    if ans > 1e18:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input()); s= 1
lis = list(map(int,input().split()))
for i in range(n):
    s = s*lis[i]
s = str(s)
if len(s)>18: print(-1)
else: print(s)

Submission status: Wrong Answer

Solution code:

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

chk = A[0]

i = 1
while i < N:
    chk = chk * A[i]
    if chk > 1000000000000000000:
        chk = -1
        break
    i+=1

print(chk)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
a = np.array(list(map(int, input().split())))
b = 1
for i in range(N):
    if b > 0:
        b *= a[i]
    if a[i] == 0:
        b = 0
    if b > 10**18:
        b = -1

print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = [int(c) for c in input().split(' ')]

    ret = 1
    for x in A:
        ret = ret * x
        if ret > 1e18:
            print('-1')
            exit()
    print(f'{ret}')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input().split()
s = [int(i) for i in s]
mul = 1
flag = 0

if 0 in s:
    print(0)
else:


    for item in s:
        mul *= item
        if flag == 1:
            break

        if mul // 1e18 >=  1.0:
            print(-1)
            flag = 1

    if mul // 1e18 <  1.0:
        print(mul)

Submission status: Wrong Answer

Solution code:
import sys

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

for i in range(N):
    mult = mult*A[i]
    if mult > 10**18:
        print('-1')
        sys.exit(0)

print(mult)

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:
N = int(input())
A = [int(n) for n in input().split()]
result = 1
max = 10**18

for i in range(N):
    result *= A[i]
    if result > max:
        print("-1")
        break
    if i == N-1:
        print(result)

Submission status: Wrong Answer

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

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]*result

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

print(result)

Submission status: Wrong Answer

Solution code:
#b
import sys
N = int(input())
inf = 10**18
a = list(map(int, input().split()))
ans = a[0]
if 0 in a:
    print("0")
    sys.exit()
for i in range(1,len(a)):
    ans = ans * a[i]

    if ans > inf:
        print(ans)
        print("-1")
        sys.exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

k = 1

for i in l:
    k = k*i
    if k > 10**18 and not 0 in l:
        print(-1)
        exit()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

for i in a:
    ans = ans*i
    if ans >= 1000000000000000000:
        ans = -1
        exit
    elif ans == 0:
        exit

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
arr=list(map(int,input().split()))
nn=1
for i in range(n):
    nn=nn*arr[i]
if nn>10**18:
    print(-1)
else:
    print(nn%((10**9)+7))

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
if 0 in a:
  ans = 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

dp = [1] * (n + 1)
for i in range(n):
    dp[i + 1] = dp[i] * A[i]
    if dp[i + 1] > 10 ** 18:
        print(-1)
        exit()

print(dp[n])

Submission status: Wrong Answer

Solution code:
n = int(input())
re = 1

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

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

Submission status: Wrong Answer

Solution code:
N=input()
a=list(map(int, input().split()))
ans=1
for v in a:
	ans*=v
	if 1000000000000000000 < ans:
		ans = -1
		break
print(ans)

Submission status: Wrong Answer

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

count = 1

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

print(count)

Submission status: Wrong Answer

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


def main():
    # a, b = map(int, input().split())
    # print(a * b)
    n = int(input())
    a = [int(i) for i in input().split()]
    limit = 10 ** 18

    if 0 in a:
        print(0)
        exit

    ans = 1
    for i in a:
        ans *= i
        if ans > limit:
            ans = -1
            break

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())

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

res=1
for x in A:
	res*=x
	if res>pow(10,18):
		print('-1')
		exit()

else:
	print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
line = input().split()

MAX = 1
for i in range(18):
    MAX = MAX * 10

ans = 1

for l in line:
    ans = int(l) * ans

if ans < MAX:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
n=int(input())
arr=list(map(int, input().split()))
mul=1
done=False
for i in range(0, len(arr)):
  mul*=arr[i]
  if mul>int(1e18):
    print("-1")
    done=True
    break
if not done:
  print(mul)

Submission status: Wrong Answer

Solution code:
N = int(input())
Nums = list()
nums = input().split()
for num in nums:
  Nums.append(int(num))
res = 1
for n in range(N):
  if(res*Nums[n]>1000000000000000000): 
    res = -1
    break
  else:
    res*=Nums[n]
print(res)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
 
import sys
import math
from collections import Counter
import itertools
import fractions
#import numpy as np
#from functools import reduce
 
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()
 
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")
 
# ###########################################
n=II()
A=LI()
 
ans = 1
for a in A:
    ans *= a
    if ans > 1000000000000000000:
        print(-1)    
        exit()
 
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
count = int(input())
list = 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:
n = int(input())
lis = list(map(int,input().split()))
res = 1
for i in lis:
    if res > 10**18:
        print(-1)
        exit()
    else:
        res *= i
print(res if res <= 10**18 else -1)

Submission status: Wrong Answer

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

ans = 1
for A in Aj:
	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().strip().split()))
ans=1;
for i in a:
    ans*=i
if(ans<=1000000000000000000):
    print(ans)

Submission status: Wrong Answer

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

result = a[0]
p = pow(10,18)

for i in range(n-1):
    result *= a[i+1]
    if result > p:
        result = -1
        break

print(result)

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

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

Submission status: Wrong Answer

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

ans = 1
for i in an:
    ans *= 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 = 10**18
ans = 1
for i in range(n):
    ans = ans * a[i]

print(ans if ans < x else -1)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
r = 1
x = 10**18
for i in a:
    if x//r < i:
        r = -1
        break
    r *= i
if r > x:
    r = -1
print(r)

Submission status: Wrong Answer

Solution code:
from numpy import prod

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

ans = prod(A)
INF = 1000000000000000000

if ans > INF:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import collections

N = 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:
import numpy as np
n = int(input())
A = list(map(int,input().split()))
X = int(np.prod(A))
if X > 10 ** 18:
  print("-1")
else:
  print(X)

Submission status: Wrong Answer

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

ans = 1
flag = True
for i in range(n):
    ans *= a[i]
           
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

min_A = min(A)
A = sorted(A, reverse=True)

if min_A == 0:
    print(0)
    exit()

for a in A:
    ans *= a
    print(f"{ans=}")
    if ans > 10 ** 18:
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
s = list(map(int,input().split()))
a = s[0]

if len(s) > 1:
    for i in range(1,N):
        if s[i] == 0:
            a=0
            break
        a = a * s[i]

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = map(int, input().split())
now = 1
if 0 in a:
    print("0")
    exit()
for one in a:
    now *= one
    if now > 1e18:
        print("-1")
        exit()

print(now)

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
        break
    

    
print(ans)

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce
a=int(input())
li = list(map(int,input().split()))

j = reduce(mul, li)
if j >= 10**18:
  print(-1)
else:
  print(j)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    A = list(map(int, input().split()))
    max_ans = 10 ** 18
    ans = 0
    for i in A:
        if ans == 0:
            ans = i
        if max_ans < ans:
            break
        else:
            ans *= i
    if max_ans < ans:
        print(-1)
    else:
        print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
MAX_RSESULT = 1000000000000000000

result = 1
for ai in a:
    result *= ai
    if result > MAX_RSESULT:
        result = -1
        break

print(result)

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

print(ANS)

Submission status: Wrong Answer

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

p = 10 ** 18

ans = 1
for a in A:
    ans = ans * a
    if ans != 0 and ans > p:
        ans = -1
        break

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:
    if a == 0:
        print(0)
        sys.exit(0)
for a in A:
    ans *= a
    if ans > 1000000000000000000:
        print(-1)
        sys.exit(0)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

f=1

    
f=np.prod(b)
print(f if f <1000000000**2 else '-1')

Submission status: Wrong Answer

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

a = 1
for i in list_input:
    a = a * i

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

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:
def intlist(x):
    y = []
    for i in range(len(x)):
        y.append(int(x[i]))
    return y
N = int(input())
A = intlist(input().split())
M = 1

for i in range(N):
    M = M * A[i]
    if M > 10**18:
        M = -1
        break
print(M)

Submission status: Wrong Answer

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

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

over = False
mul = 1
for a_ in a:
    mul *= a_
    if mul > 10**18:
        mul = -1
        break
print(mul)

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)) >= 18:
    print("-1")
else:
    print(str(result))

Submission status: Wrong Answer

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

print(a)

Submission status: Wrong Answer

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

ans = 1
for ni in A:
  ans *= ni
  if ans > 1000000000000000000:
    print('-1')
    exit()
    
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A = [int(x) for x in input().split()]
x=1
flg=0
for i in range(N):
  x=x*A[i]
  if x>10**18:
    flg=1
    break
if flg==1:
  print(-1)
else:
  print(x)
"""
3
101 9901 999999000001
"""