Problem:


Score : 200 points

Problem Statement

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

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

Constraints

2 \leq N \leq 10^5

0 \leq A_i \leq 10^{18}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 ... A_N

Output

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

Sample Input 1

2
1000000000 1000000000

Sample Output 1

1000000000000000000

We have 1000000000 \times 1000000000 = 1000000000000000000.

Sample Input 2

3
101 9901 999999000001

Sample Output 2

-1

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

Sample Input 3

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

Sample Output 3

0



Sample input:
2
1000000000 1000000000


Sample output:
1000000000000000000

Submission status: Wrong Answer

Solution code:
import math
 
N = int(input())
x_list = list(map(int, input().split()))
 
#result = math.prod(x_list)
result = 1
for x in x_list:
  result *= x
  if result >1e18:
    print(-1)
    exit()
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
    print(0)
    exit()
a = sorted(a, reverse=True)
res = a[0]
for ai in a[1:]:
    res *= ai
    if res > 10**18:
        print(-1)
        exit()

Submission status: Wrong Answer

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

a = 1
l.sort(reverse=True)
for i in l:
	a *= i
	if a > 10**18:
		a = -1
		break
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-
N = int(input())
A = list(map(int,input().split()))

num = 1

for i in A:
  num *= i
  if num > 10 ** 18:
    num = -1
    break
  else:
    continue
  break
    
print(num)

Submission status: Wrong Answer

Solution code:
p=int(input())
ans=1
ar=list(map(int,input().split()))
if 0 in ar:ans=0
else:
    for i in range(p):
        if ans<1e18:ans*=ar[i]
        else:ans=-1;break
if ans<1e18:ans=-1
print(ans,end='')

Submission status: Wrong Answer

Solution code:
INF=10**18
n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
for val in a:
	if val==0:
		print(0)
		exit()
	if ans>INF:
		print(-1)
		exit()
	ans*=val
else:
	print(ans)

Submission status: Wrong Answer

Solution code:
INF=10**18
n=int(input())
a=list(map(int,input().split()))
ans=1
for val in a:
	if val==0:
		print(0)
		exit()
	if ans>INF:
		print(-1)
		exit()		
	ans*=val
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)
ans = -1 if ans > 1000000000000000000 else np.prod(A)
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)
ans = -1 if ans > 1000000000000000000 else ans
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)
ans = -1 if ans >= 1e+18 else ans
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)
ans = -1 if ans > 1e+18 else ans
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 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()))
ans = 1
for i in A:
    ans *= i
    if ans > 10**18:
        print(-1)
        break
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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


#リストAの要素をすべて掛け算
product = np.prod(A)

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

print(product)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(x)

Submission status: Wrong Answer

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

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

print(x)

Submission status: Wrong Answer

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

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

print(x)

Submission status: Wrong Answer

Solution code:
import math
T = int(input())
a = list(map(int, input().split()))
n = math.prod(a)
if n < 1000000000000000000:
  print("-1")
else:
  print(n)

Submission status: Wrong Answer

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

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

if N > 0:
	A = 1
	for O in d:
		A = A * O
		#print(O)
		if A > 1000000000000000000:
			A = -1
			break
else:
	A = 1

print(A)

Submission status: Wrong Answer

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

sum = 1
A.sort()
for i in A:
    sum = sum*i
    if sum >= pow(10,18):
        sum = -1
        break
print(sum)

Submission status: Wrong Answer

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

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

print(A)

Submission status: Wrong Answer

Solution code:
import functools
n = int(input())
arr = [int(a) for a in input().split()]
m = 10 ** 18

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce

def main ():
  count = int(input())
  c = list(map(int,input().split()))

  if 0 in c:
    print(0)

  a = reduce(mul, c)

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

main()

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce

def main ():
  count = int(input())
  c = list(map(int,input().split()))

  if 0 in c:
    print(0)

  a = reduce(mul, c)

  if a > 1000000000000000000:
    print('-1')
  else:
    print(a)

main()

Submission status: Wrong Answer

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

ans = 1

import sys

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

print(ans)

Submission status: Wrong Answer

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

ans = 1

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

Submission status: Wrong Answer

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

ans = 1

for a in A:
  if ans > 10e18:
    print(-1)
    import sys
    sys.exit()
  else:
    ans *= a
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  if num == 0:
    sum = 0
    break
  if flag == 1:
    sum = sum * num
    if sum > upper:
      flag = 2

if flag == 1:
  print(sum)
elif flag == 2:
  print(-1)

Submission status: Wrong Answer

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

    
  prod = 1
  for i in a:
    prod *= int(i)
    if prod >1000000000000000000:
      print(-1)
      return

  print(prod)

main()

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  sum = sum * num
  if sum > upper:
    flag = 0
  elif num == 0:
    sum = 0
if flag == 1:
  print(sum)
else:
  print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 0
upper = pow(10, 18)
for num in nums:
  sum = sum * num
  if sum > upper:
    print(-1)
    flag = 1
    break
if flag == 0:
    print(sum)

Submission status: Wrong Answer

Solution code:
n = int(input())
lists = list(map(int, input().split()))
number = 1
for j in lists:
  if j == 0:
    number = 0
    break
  if number > 10 ** 18:
    number = -1
    break
  number = number * j
print(str(number))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Ans = 1
for i in range(0,len(A)):
    Ans *= A[i]
    if Ans > 10**9:
        print(-1)
        exit()
    else:
        continue
print(Ans)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
A.sort(reverse=True)
if(A[-1] == 0):
  print(0)
else:
  p = 1
  for An in A:
    p *= An
  if(p > 10 ** 18):
    print(-1)
  else:
    print(p)

Submission status: Wrong Answer

Solution code:
import sys
A = list(map(int, input().split()))
A.sort(reverse=True)
if(A[-1] == 0):
  print(0)
else:
  p = 1
  for An in A:
    p *= An
    if p > 10 ** 18:
      print(-1)
      sys.exit()
  print(p)

Submission status: Wrong Answer

Solution code:
import sys
A = list(map(int, input().split()))
A.sort(reverse=True)
if(A[0] == 0):
  print(0)
else:
  p = 1
  for An in A:
    p *= An
    if p > 10 ** 18:
      print(0)
      sys.exit()
  print(p)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
A.sort(reverse=True)
if(A[0] == 0):
  print(0)
else:
  p = 1
  for An in A:
    p *= An
    if p > 10 ** 18:
      print(0)
      break
  print(p)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort()
if A[0] == 0:
    print(0)
else:
    ans = 1
    for a in A:
        ans *= a
        if ans > 1000000000000000000:
            print(-1)
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort()
if A[0] == 0:
    print(0)
else:
    ans = 1
    for i in A:
        if ans > 1000000000000000000:
            print(-1)
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
#sys.stdin=open('input.txt','r')
#sys.stdout=open('output.txt','w')
from sys import stdin,stdout
from collections import deque,defaultdict
from math import ceil,floor,inf,sqrt,factorial,gcd,log2
from copy import deepcopy
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
mod=1000000007
n=ii1()
arr=iia()
max=10**18
res,flag=1,0
for i in range(n):
    res*=arr[i]
    if res>max:
        flag=1
        break
if flag==1:
    print(-1)
else:
    print(res)

Submission status: Wrong Answer

Solution code:
from sys import stdin,stdout
from collections import deque,defaultdict
from math import ceil,floor,inf,sqrt,factorial,gcd,log2
from copy import deepcopy
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
mod=1000000007
n=ii1()
arr=iia()
flag=0
res=1
for i in range(n):
  res*=arr[i]
  if arr[i]>1000000000000000000:
    flag=1
    break
if flag==1:
  print(-1)
else:
  print(res)

Submission status: Wrong Answer

Solution code:
def prod(l):
  neut=1
  for i in l:
    neut*=i
  return neut

input()
ans=prod([int(i) for i in input().split()])
if(ans<1000000000000000000):
  print(ans)
else:
  print(-1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import functools
import operator
n = int(input())
a = list(map(int,input().split()))
r = functools.reduce(operator.mul, a)
if r < 10000000000000000000:
  print(r)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
import functools
import operator
n = int(input())
a = list(map(int,input().split()))
r = functools.reduce(operator.mul, a)
if r < 10**18:
  print(r)
else:
  print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
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 = input()
a = list(map(int, input().split()))
if np.prod(a) > 10 ^ 18:
  print(-1)
else:
  print(np.prod(a))

Submission status: Wrong Answer

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

num = 1
for k in range(n):
    num *= a[k]
    if num > 10**18:
      num = "-1"
      break

print(num)

Submission status: Wrong Answer

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

print(n)
print(a)

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

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

Submission status: Wrong Answer

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

if 0 in x: ans=0

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(len(a)):
    c = c * a[i]
    if c >= pow(10,18):
        print(-1)
        exit(0)

print(c)

Submission status: Wrong Answer

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

for i in range(len(a)):
    c = c * a[i]
    if c > pow(10,18):
        print(-1)
        exit(0)

print(c)

Submission status: Wrong Answer

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

ans = 1
for a in range(len(a_lst)):
    ans = ans *a
if ans > 10**18:
    print("-1")
else:
    print(ans)

Submission status: Wrong Answer

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

ans = 1
for a in range(len(a_lst)):
    ans *= a
if ans > 10**18:
    print("-1")
else:
    print(ans)

Submission status: Wrong Answer

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

ans = 1
for a in range(len(a_lst)):
    ans *= a
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

out_range = 10**18

ans=1
for i in range(N):
    tmp = P[i]
    if tmp == 0:
        print(0)
        exit()
    ans *= tmp
    if  ans > out_range:
        print(-1)
        exit()

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int,input().split()))
a_zero_num1 , a_zero_num2 = 0,0

if '0' in a_list:
  print(0)
else:
  # 桁が何桁なのかを確認、
  #　全ての数字の桁数を足して、数字x３を引いて最後に１足した数値が18以上なら志望
  prod = 1
  for a in a_list:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
print(prod)

Submission status: Wrong Answer

Solution code:
H = int(input())
ss = list(map(int, input().split()))
nn=1
for i in range(H):
  nn*=ss[i]
if nn>(10^18):
  print("-1")
else:
  print(nn)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for n in A:
    ans *= n
    if ans>10**18:
        print (-1)
print (ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split(" ")))
ans=1
POW=pow(10,18)
check=False
for i in range(n):
  ans*=A[i]
  ans=(ans+abs(ans))/2
  if ans>POW:
    ans=-1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = sorted([int(e) for e in input().split()])
ans = 1
for a in nums:
    ans *= a
    if(10 * 18 < ans):
        ans = -1
        break
    elif(ans == 0):
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = [int(e) for e in input().split()]
ans = 1
for i in range(n):
    ans *= nums[i]
    if(10 * 18 < ans):
        ans = -1
        break
    elif(ans == 0):
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = 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()))

if 0 in A:
  print(0)
else:
  result=1
  for i in A:
    result*=i

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

Submission status: Wrong Answer

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

if 0 in A:
  print(0)
else:
  result=1
  for i in A:
    result*=i
    print(result)

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

Submission status: Wrong Answer

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

if 0 in A:
  print(0)
else:
  a=1
  for i in range(N):
    a*=int(A[i])

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

Submission status: Wrong Answer

Solution code:
import math 
t = int(input())
list_v = [int(x) for x in input().split()]

res = float(math.prod(list_v))

if res > math.pow(10,18):
	print(-1)
else:
	print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if 0 in A:
  mult = 0

for i in range(N):
  mult *= A[i]
  if mult > 1e18:
    print(-1)
    break

print(mult)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
mult = 1
for i in range(N):
  mult *= A[i]
  if mult > 1e18:
    break

if mult > 1e18:
  print(-1)
else:
  print(mult)

Submission status: Wrong Answer

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

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

print(kotae)

Submission status: Wrong Answer

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

kotae = 1
for i in range(n):
  kotae *= a[i] % (10 ** 18)
 
print(kotae)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import numpy as np
 
n = int(input())
numlist = list(map(int, input().split()))
ans = 1;
 
for i in numlist:
    if i == 0:
        ans = 0
        break
    ans *= i
    if ans > 10**18:
        ans = -1
        break
 
print(ans)

Submission status: Wrong Answer

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

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

if np.prod(numlist) > 10**18:
    ans = -1
else:
    for i in numlist:
        if i == 0:
            ans = 0
            break
        ans *= i

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

for i in numlist:
    if i == 0:
        ans = 0
        break
    ans *= i
    if ans > 10**18:
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
numlist=list(map(int,input().split()))
result=1
for x in numlist:
    result=result*x
    if result>1000000000000000000:
        print(-1)
        break
if result<=1000000000000000000:
    print(result)

Submission status: Wrong Answer

Solution code:
N=int(input())
numlist=list(map(int,input().split()))
result=1
for x in numlist:
    result=result*x
    if result>1000000000000000000:
        print(-1)
        break
    print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

array = np.array(list(map(float, input().split())))
val = np.prod(array)
if val > 1e18:
  print(-1)
else:
  print(val)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
a=[int(x) for x in input().split()]
a_log=[]
for i in a:
  if i == 0:
    i+=10**(-30)
  i_log=math.log10(i)
  a_log.append(i_log)
  
if sum(a_log)>18:
  print("-1")
else:
  for i in range(n-1):
  	a[i+1]*=a[i]
  if a[n-1]>10**18:
    print("-1")
  else:
    print(a[n-1])

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
a=[int(x) for x in input().split()]
a_log=[]
for i in a:
  if i == 0:
    i+=10**(-7)
  i_log=math.log10(i)
  a_log.append(i_log)
  
if sum(a_log)>18:
  print("-1")
else:
  for i in range(n-1):
  	a[i+1]*=a[i]
  if a[n-1]>10**18:
    print("-1")
  else:
    print(a[n-1])

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
a = map(int, input().split())
for i, number in enumerate(a):
    if i == 0:
        number = number
    else:
        number *= number
if number > pow(10, 18):
    print('-1')
else:
    print(number)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from functools import reduce
l = 10**18
n = int(input())
A = list(map(int,input().split()))
S = 1
for i in range(n):
    S = S * A[i]
    if S > l:
        print(-1)
        break
if S <= l:
    print(S)

Submission status: Wrong Answer

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

ans = 1

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

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