Problem:


Score : 200 points

Problem Statement

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

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

Constraints

2 \leq N \leq 10^5

0 \leq A_i \leq 10^{18}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 ... A_N

Output

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

Sample Input 1

2
1000000000 1000000000

Sample Output 1

1000000000000000000

We have 1000000000 \times 1000000000 = 1000000000000000000.

Sample Input 2

3
101 9901 999999000001

Sample Output 2

-1

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

Sample Input 3

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

Sample Output 3

0



Sample input:
2
1000000000 1000000000


Sample output:
1000000000000000000

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a_L = list(map(int,input().split()))
a_L = sorted(a_L)
           
if a_L[0] == 0:
  print(0)

ans = 0

for i in range(len(a_L)):
  ans = ans*a_L[i]
  if ans >= 10**8:
    print(-1)
    exit()
print(ans)

Submission status: Wrong Answer

Solution code:
num = input()
a = input().split()

b=1
for i in a:
	b *= int(i)
    
print(b)

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
l = list(map(int, input().split()))
a=np.array(l,dtype='float')
x=np.prod(a)
y = -1 if x > 10**18 else x
print(y)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
l = list(map(int, input().split()))
a=np.array(l, dtype='float64')
x=np.prod(a)
y = -1 if x > 10**18 else x
print(y)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from functools import reduce

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

#n = 5
#S = [1,2,3,4,5]

#ans = int(1)
#print(n)
#print(S)
#print(ans)

ans = reduce(lambda x, y: x * y, S)

#for i in S:
#    if i == 0:
#        break
#    else:
#        ans = ans * i
#        if ans >= 10**18:
#            print(-1)

#    ans = ans * i
#    
if ans >= 10**18:
    print(-1)
else:
    print(ans)
#        break
#    else:
#        continue
#    print(ans)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

#n = 5
#S = [1,2,3,4,5]

ans = int(1)
#print(n)
#print(S)
#print(ans)

for i in S:
    ans = ans * i
    if ans >= 10**18:
        print(-1)
        break
    else:
        continue
#    print(ans)

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

Submission status: Wrong Answer

Solution code:
print("-1")

Submission status: Wrong Answer

Solution code:
n=int(input())
num=[int(x) for x in input().split()]
if 0 in num:
  print('0')
else:
  sum=1
  for i in num:
    if i>10000000000000000000000000000000000000000000000000000000:
      print('-1')
      break
    else:
      sum=sum*i
  print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
l = list(map(int, input().split()))
x = np.array(l).prod()
if x == 0 :
  print(x)
  exit()
y = -1 if x > 10**18 else x
print(y)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
l = list(map(int, input().split()))
x = 0
for i in range(n):
  if i == 0 : x = l[i]
  else : x = x * l[i]
if x == 0 :
  print(x)
  exit()
y = -1 if int(math.log10(x)) > 18 else x
print(y)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int ,input().split()))
b = 1
for i in range(len(a)):
	b = b * a[i]
print(b)

Submission status: Wrong Answer

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

ans = 1

for num in a:
  ans *= num
  if ans > 1000000000000000000:
    ans = -1
    break

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
x=10**18
l=list(map(int,input().split()))
if 0 in l:
  print("0")
s=1
for i in l:
  s=s*i
  if s>x:
    break
if s<=x:
  print(s)
else:
  print("-1")

Submission status: Wrong Answer

Solution code:
n=int(input())
x=10**18
l=list(map(int,input().split()))
if 0 in l:
  print("0")
s=1
for i in l:
  s=s*i
if s<=x:
  print(s)
else:
  print("-1")

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
s=1
for i in l:
  s=s*i
if s<=10**8:
  print(s)
else:
  print("-1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys

# スペース区切りの整数の入力
N, *d = map(int, open(0).read().split())
A = 1

for O in d:
    A = A*O
    if A > 10 ** 18:
     A = -1
     break
    
print(A)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys

# スペース区切りの整数の入力
N, *d = map(int, open(0).read().split())
A = 1

for O in d:
    A = A*O
    print(O)
    if A > 10 ** 18:
     A = -1
     break
    
print(A)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if 0 in list:
  print(0)
  exit(0)
  
total = 1
for i in list:
  total *= i
  if(total > 100000000000000000):
    print(-1)
    exit(0)
print(total)

Submission status: Wrong Answer

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

total = 1
for i in list:
  total *= i
if(total < 100000000000000001):
  print(total)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
L=[]
L=list(map(int,input().strip().split()))
Ll=len(L)
Ls=1
for i in range(Ll):
  	Ls=Ls*L[i]
if Ls>10^18:
	print(Ls)
else:
	print("-1")

Submission status: Wrong Answer

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

x = 1
for e in lst:
  x *= e
  
print(x)

Submission status: Wrong Answer

Solution code:
L=[]
L=list(map(int,input().strip().split()))
Ll=len(L)
Ls=1
for i in range(Ll):
  	Ls=Ls*L[i]
print(Ls)

Submission status: Wrong Answer

Solution code:
L=[]
L=list(map(int,input().strip().split()))
Ll=len(L)
Ls=1
for i in range(Ll):
  	Ls=Ls*L[i]
if Ls<10^18:
	print(Ls)

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 a in A:
        ans *= a
        if ans > 1000000000000000000:
            ans = -1
            break
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
As = map(int, input().split())
result = 1
 
for a in As:
  result *= a
 
if a >= 10**18:
  print("-1")
else:
  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 = ans * A[i]
  if abs(ans) > 10**18:
    ans = -1
  
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
m = 1
for n in input().split():
  i = int(n)
  m = m * i
  if m > 10 ** 18:
    m = -1
    break
print(m)

Submission status: Wrong Answer

Solution code:
N = int(input())
As = map(int, input().split())
result = 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
lim = 1e18
n = int(input());
nums = list(map(int,str(input()).split(" ")))
ans = 1
for num in nums:
    ans *= num
    if ans > lim:
    	break
if ans > lim:
	print(-1)
else:
	print(int(ans))

Submission status: Wrong Answer

Solution code:
lim = 1e18
n = int(input());
nums = list(map(int,str(input()).split(" ")))
ans = 1
for num in nums:
    if ans <= lim:
    	ans *= num
if ans > lim:
    print(-1)
else:
    print(int(ans))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def solve(n, a):
  if 0 in a:
    return 0
  else:
    p = 1
    x = 10**18
    for i in a:
      if p>x:
        return -1
      p*=i
    return p

n = int(input())
a = [int(x) for x in input().split()]
print(solve(n, a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = 1
x = pow(10, 18)
f=True
for i in input().split():
  if a<=x:
    a*=int(i)
  else:
    f=False
    break
if f:
  print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L = 1000000000000000000
r = 1
n = input()
A = list(map(int, input().split()))
A = sorted(A)
p = True
while len(A) > 0:
    b = A.pop()
    r *= b
    if r > L:
        print(-1)
        p = False
        break
if p: print(r)

Submission status: Wrong Answer

Solution code:
L = 1000000000000000000
r = 1
for a in map(int, input().split()):
    r *= a
if r > L: print(-1)
else: print(r)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
i=n-1
res=1
z=10**18
while(i>=0):
    if(res>z/a[i]):
        res=z+1
        break
    res*=a[i]
    if(a[i]>z):
        break
    i-=1
if(res>z):
    res=-1
print(res)

Submission status: Wrong Answer

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

z=10**18
for i in a:
    if(i > z/res):
        res=-1
        break
    res*=i
    if(i>z):
        res=-1
        break
print(res)

Submission status: Wrong Answer

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

z=10**18
for i in a:
  if(i > z/res):
    res=-1
    break
    res*=i
    if(i>z):
      res=-1
      break
      print(res)

Submission status: Wrong Answer

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

z=10**18
for i in a:
    if(i > z/res):
        res=-1
        break
    res*=i
    if(i>z):
        res=-1
        break
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

ans = A[0]
for ai in A[1:]:
    ans *= ai
    if ans > 10 ** 18:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def q_b():
    k = int(input())
    a = map(int, input().split())

    is_finished = False
    for i in a:
        if i == 0:
            print(0)
            is_finished = True
        break

    if is_finished:
        return

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

    if 1 <= answer and answer <= 10 ** 18:
        print(answer)


if __name__ == '__main__':
    q_b()

Submission status: Wrong Answer

Solution code:
def q_b():
    k = int(input())
    a = map(int, input().split())

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

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


if __name__ == '__main__':
    q_b()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    arr = list(map(int, input().split()))
    a = 1
    for i in arr:
        a*=i
        if a>10**18:
            print("-1")
            return
    
    print(a)
main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    arr = list(map(int, input().split()))
    a = 1
    for i in arr:
        a*=i
        if a>10**18:
            print("-1")
            return
    
    print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = list(int(i) for i in input().split(" "))

prod = 1

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



print(prod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    ans = solve(n, a)
    print(ans)

def solve(n, a):
    if 0 in a:
        return 0
    lim = 10 ** 18
    ans = 1
    for i in a:
        ans *= i
        print(f'{ans:}')
        if ans > lim:
            return -1
    return ans

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

a = sorted(a)

ans = 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

Submission status: Wrong Answer

Solution code:
import math

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

flag = True
prod = 1
for i in range(N):
    prod *= A[i]
    if prod > 10**18:
        flag = False
        break

if flag == True:
    print(prod)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    import sys
    input = sys.stdin.readline

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

    for ai in a:
        ans *= ai

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

sorted(num)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def calc(num_list) -> int:
    result = 1
    max = 10**18

    if 0 in num_list:
        return 0
        
    for num in num_list:
        result *= num
        if result > max:
            return -1
    return result

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

print(str(calc(num_list)))

Submission status: Wrong Answer

Solution code:
def calc(num_list) -> int:
    result = 1
    max = 10**18
    for num in num_list:
        if num == 0:
            return 0
        else:
            result = result * num
            if result > max:
                return -1
    return result

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

print(str(calc(num_list)))

Submission status: Wrong Answer

Solution code:
def calc(num_list) -> int:
    result = 1
    max = 10**18
    for num in num_list:
        if num == 0:
            return 0
        else:
            result = result * num
            if result > max:
                return -1
    return result

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

print(calc(num_list))

Submission status: Wrong Answer

Solution code:

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

max = pow(10, 18)
result = 1
for num in num_list:
    if num == 0:
        print(0)
        break
    else:
        result = result * num
        if result > max:
            print(-1)
            break 
print(result)

Submission status: Wrong Answer

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

#
ans =0
if 0 in A:
    ans =0
else:
    ans =np.prod(A)
    #print(ans)
    if  ans <=0 or 10**18 < ans:
        ans =-1
print(ans)

Submission status: Wrong Answer

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

#
ans =0
if 0 in A:
    ans =0
else:
    ans =np.prod(A)
    if  ans <0 or 10**18 < ans:
        ans =-1
print(ans)

Submission status: Wrong Answer

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

#
ans =0
if 0 in A:
    ans =0
else:
    ans =np.prod(A)
    if 0 < 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()))
A =np.array(A,dtype=np.int64)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = 1
if 0 in A:
    ans = 0
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
for i in A:
    ans *= i
    if ans >= 10**18:
        ans = -1
        exit()
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
        exit()
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
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
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**8:
    ans = -1
print(ans)

Submission status: Wrong Answer

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

def multiplication2(n,a):
    #acc = functools.reduce(lambda x,y:x*y, a)
    acc = 1
    for s in a:
        acc = acc*s
        if 10**18 < acc:
            acc = -1
            break
    return acc

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    print(multiplication2(n,a))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 1
arr = input().split(" ")
x = True
for i in range(n):
  ans = ans*int(arr[i])
  if ans > 1000000000000000000:
    print(-1)
    x = False
if x:
  print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
number=[int(x) for x in input().split()]
sum = number[0]
for numb in number:
  sum *= numb
if(sum != 0):
  sum /= number[0]
if(sum > 10 ** 18):
	print(-1)
else:
  print(sum)

Submission status: Wrong Answer

Solution code:
n=int(input())
number=[int(x) for x in input().split()]
sum = number[0]
for numb in number:
  sum *= numb
sum /= number[0]
if(sum > pow(10,18)):
	print(-1)
else:
  print(sum)

Submission status: Wrong Answer

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

sum = 1
for numb in number:
  sum *= numb
if(sum >= pow(10,18)):
	print(-1)
else:
  print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input_num = input()
input_list = input()
 
total_pow = 1
for num in input_list.split(" "):
  total_pow *= int(num)
  if total_pow > 10**18:
  	print("-1")
  	sys.exit()
print(total_pow)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

N = I()
A = LI()
ans = 1
for i in A:
    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())) 

result = 1
for i in A:
    result *= i
    if result > 10**18:
        result = -1
        break

print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

result = 1
for i in A:
    result *= i
    if result > 10**18:
        result = -1
        break

print(result)

Submission status: Wrong Answer

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

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