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 sys
N=int(input())
A=list(map(int,input().split()))
if 0 in A:
    print(0)


ans=1
for elem in A:
    ans*=elem
    if ans>10**18:
        print(-1)
        sys.exit()
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
 
N=int(input())
#print(N)
A=input().split()
A_int = [int(s) for s in A]
#print(A_int)
ans=1
for i in range(N):
  ans=ans*A_int[i]
  if(ans>10**18):
    ans=-1
    break

print(ans)

Submission status: Wrong Answer

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

b=int(a[0])

del a[0]

c=1
for x in a:
  c=c*int(x)
  
if c > 10**18:
  print(-1)
else:  
  print(c)

Submission status: Wrong Answer

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

b=int(a[0])

del a[0]

c=1
for x in a:
  c=c*int(x)
  
print(c)

Submission status: Wrong Answer

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


def f(list):
    a = 1
    for i in list:
        a = a*i
    return a


if 0 in a:
    print(0)
else:


    log_prod_a = sum(map(math.log10, a))
    if log_prod_a < 18.0:
        print(f(a))
    else:
        print(-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
ary = list(input().split())

if "0" in ary:
    print(0)
else:
    length = sum(map(len,ary))
    print(length-n)
    if length-n > 18:
        print(-1)
    else:
        multiple = 1
        while ary:
            multiple *= int(ary.pop())
        if multiple > 10**18:
            print(-1)
        else:
            print(multiple)

Submission status: Wrong Answer

Solution code:
n = input()
ary = list(input().split())

if "0" in ary:
    print(0)
else:
    length = sum(map(len,ary))
    if length > 18:
        print(-1)
    else:
        multiple = 1
        while ary:
            multiple *= int(ary.pop())
        print(multiple)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

ans = 1
for i in range(n):
  ans = ans*a[i]
  #外れ値
  if ans > 10**18:
    print(-1)
    exit()
  #0
  if a[i] == 0:
    print(0)
    exit()
    
print(ans)

Submission status: Wrong Answer

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

ans = 1
for i in range(n):
  ans = ans*a[i]
  #外れ値
  if ans > 10**18:
    print(-1)
    exit()
  #0
  if a[i] == 1:
    print(0)
    exit()
    
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

      if b>10**8:
        print(-1)
        return
   
    print(b)

f()

Submission status: Wrong Answer

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

    if b<=10**8:
      print(b)
    else: print(-1)

f()

Submission status: Wrong Answer

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

    if b<=10**8:
      print(b)
    else: print(-1)

f()

Submission status: Wrong Answer

Solution code:
N = input().split()
A = input().split()
ans = 1
for i in A:
  if len(i) >= 19:
    ans = -1
    break
  ans = ans * int(i)
  if len(str(ans)) >= 19:
    ans = -1
    break
print(ans)

Submission status: Wrong Answer

Solution code:
N = input().split()
A = input().split()
ans = 1
for i in A:
  ans = ans * int(i)
  if len(str(ans)) >= 19:
    ans = -1
    break
print(ans)

Submission status: Wrong Answer

Solution code:
N = input().split()
A = input().split()
ans = 1
for i in A:
  ans = ans * int(i)
if len(str(ans)) >= 19:
  ans = int(-1)
print(ans)

Submission status: Wrong Answer

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

if b<=10**8:
  print(b)
else: print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#intの場合
N = int(input()) #ここで標準入力

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

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



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


if 0 in A:
    print(0)
    

output = 1
for a in A:
    output *= a

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

print(output)

Submission status: Wrong Answer

Solution code:
#intの場合
N = int(input()) #ここで標準入力

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

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



if 10 ** 18:
    print(multiple)
else:
    print(-1)

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

Submission status: Wrong Answer

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

mx = 1e18
pr = 1
done = True

for i in a:
	pr = pr*i
	if pr > mx:
		done = False
		break

if done:
	print(pr)
else:
	print(-1)

Submission status: Wrong Answer

Solution code:
c = 10**18

def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = 1

    for i in a:
        b *= i
        if b > c:
            print(-1)
            return

    print(b)

main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if 0 in A:
    print(0)
    exit()
ans = 1
for a in A:
    ans = ans * a
    if len(str(ans)) > 19:
        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(0)
    exit()
ans = 1
for a in A:
    ans = ans * a
    if len(str(ans)) >= 18:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

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

ans = 1
for a in A:
    ans = ans * a

if len(str(ans)) >= 18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
times= int(input())
nums= list(map(int, input().split()))
a= 1
if 0 in nums:
  print(0)
  exit()
for i in nums:
  a*= i
  if a > 10**18:
    print('-1')
else:
  print(a)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
times= int(input())
a= 1
for i in list(map(int, input().split())):
  a*= i

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    ps = [int(x) for x in input().split()]
    a = 1
    for p in ps:
        a *= p
        if a > 10 ** 18:
            print(-1)
            return
        
    print(a)

    
main()

Submission status: Wrong Answer

Solution code:
a1 = int(input())
b2 = input().split(" ")

def check(a , b):
  score = 1
  maximam = 10 ** 18
  if '0' in b:
    return print(0)
  else:
    for i in range(a):
      score *= int(b[i])
      maximam /= int(b[i])
      if maximam < 0:
        return print(-1)
    return print(score)

check(a1 , b2)

Submission status: Wrong Answer

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

product = 1

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

print(product)

Submission status: Wrong Answer

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

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

print(product)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()
a_int = [int(n) for n in a]
ans = 1
for num in a_int:
    ans *= num
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(N-1):
  p[i+1] = p[i] * p[i+1]
  if p[i+1] > 10**18:
    print('-1')
    exit()
print(p[i+1])

Submission status: Wrong Answer

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

res = 1

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

Submission status: Wrong Answer

Solution code:
allnum = int(input())

list = input().split()

list_i = [int(s) for s in list]

result = 0

if 0 in list_i:
  	print(0)
else:
    for n in list_i:
        result = result * n
        if result > 1000000000000000000:
            result = -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)
keta=1
for i in A:
    keta*=i
    if keta>1000000000000000000:
        break
    
if keta>1000000000000000000:
    print(-1)
else:  
    print(keta)

Submission status: Wrong Answer

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

if min(A) == 0:
    ans = 0

order = 0
for i in A:
    order = order + len(str(i))-1

if order > 18:
    ans = -1

else :
    for i in A:
        ans = ans*i

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

Submission status: Wrong Answer

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

if min(A) == 0:
    ans = 0

order = 0
for i in A:
    order = order + len(str(i))-1

if order > 18:
    ans = -1

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

Submission status: Wrong Answer

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

if 0 in a_nums:
  print(0)

ans = 1
for num in a_nums:
  ans *= num

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

maxi = 10 ** 18
sm = 1
for a in arr:
    sm *= a
    if sm >= maxi:
        print(-1)
        exit(0)

print(sm)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
a = input().split()
b = 1
for num in range(n):
  b = b * num
print(b)

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
a = list(map(str, input().split()))
total = 1

if '0' in a:
    print('0')
    sys.exit()
for i in a:
    total *= int(i)
    if total >= 10**18:
        print('-1')
        sys.exit()
print(total)

Submission status: Wrong Answer

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

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


print(ans)

Submission status: Wrong Answer

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

x =1

if min(a) ==0:
    ans =0
else:
    order =0
    for i in a:
        order = order+len(str(i))-1

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

Submission status: Wrong Answer

Solution code:
s = int(input())

#a = [input() for i in range(s)]
a = list(map(int, input().split()))

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

print(ans)

Submission status: Wrong Answer

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

x =1
for i in a:

    x = x*i

print (x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
t=int(input())
s=1
p=10**18
a=list()
q=input()
a=q.split(" ")
for i in range(len(a)):
    s=s*int(a[i])
if( s!=0 and p%s>1 ):
    print("-1")
else:
    print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

r = 1
t = 10 ** 18
for x in a:
  r *= x
  if r > t:
    break
    print(-1)
if r <= t:
  print(r)

Submission status: Wrong Answer

Solution code:
a = int(input())

b = input().split(" ")

t = "0"

if t in b:
  print(0)

score = 1
for i in range(a):
  j = int(b[i])
  score *= j
  if score > 10 ** 18:
    print(-1)

print(score)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if 0 in a:
  print(0)
else:
  for i in a:
    u *=i
#  print(u)  
  if u < 10**18:
    print(u)
  else:
    print(-1)

Submission status: Wrong Answer

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

if 0 in a:
  print(0)
else:
  for i in a:
    u *=i
#  print(u)  
  if u < 10**18:
    print(u)
  else:
    print(-1)

Submission status: Wrong Answer

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

if 0 in a:
  print(0)
else:
  for i in a:
    u = i*u
#  print(u)  
  if u < 10**18:
    print(u)
  else:
    print(-1)

Submission status: Wrong Answer

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

if 0 in a:
  print(0)
else:
  for i in a:
    u = i*u
#  print(u)  
  if len(str(u)) < 18:
    print(u)
  else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np
n=int(input())
i=list(map(int, input().split()))
k =np.prod(i)
if k<=10**18:
  print(k)
else:
  print("-1")

Submission status: Wrong Answer

Solution code:
import numpy as np
n=int(input())
i=list(map(int, input().split()))
k =np.prod(i)
if k<10**18:
  print(k)
else:
  print("-1")

Submission status: Wrong Answer

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

k = 1
if 0 in A:
	print(0)
else:
	for i in A:
		k = k * i
		if k > 10 ** 18:
			print(-1)
			break
	if k <= 10 ** 18:
		print(k)

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

read = stdin.readline
write = stdout.write
flush = stdout.flush
xr = range

def main():
	n = int(read())
	a = map(int,read().split())
	if 0 in a:
		write('0\n')
		return
	prod = 1
	for i in a:
		prod *= i
		if prod > 10 ** 18:
			write('-1\n')
			return
	if prod <= 10**18:
		write (str(prod) + '\n')

main()

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

read = stdin.readline
write = stdout.write
flush = stdout.flush
xr = range

def main():
	n = int(read())
	a = map(int,read().split())
	if 0 in a:
		write('0\n')
		return
	prod = 1
	for i in a:
		prod *= i
		if prod > 10 ** 18:
			write('-1\n')
			return
	write (str(prod) + '\n')

main()

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

read = stdin.readline
write = stdout.write
flush = stdout.flush
xr = range

def main():
	n = int(read())
	a = map(int,read().split())
	if 0 in a:
		write('0\n')
		return
	prod = 1
	for i in a:
		prod *= i
	if prod > 1000000000000000000:
		write('-1\n')
		return
	write (str(prod) + '\n')

main()

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

if la[-1] == 0:
    print(0)
    exit()

for a in la:
    if math.log10(a) > 18:
        print(-1)
        exit()
    ans *= a
    if ans % 10 == 0 and math.log10(ans) == 18:
        print(ans)
    elif math.log10(ans) > 18:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

if la[-1] == 0:
    print(0)
    exit()

for a in la:
    ans *= a
    if a == 0:
        print(a)
        exit()
    elif ans % 10 == 0 and math.log10(ans) == 18:
        print(ans)
    elif math.log10(ans) > 18:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

if la[-1] == 0:
    print(0)
    exit()

for a in la:
    ans *= a
    if a == 0:
        print(a)
        exit()
    elif math.log10(ans*10e+5) > 23:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
a = 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()))
result=1
for i in A:
    result*=i
    if result>10**18:
        break
if result>10**18:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort()
ans = 1
for a in la:
    ans *= a
    if a == 0 or math.log10(ans*10e+5) > 23:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

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

for a in la:
    ans *= a
ans *= 10e+5
if(ans > 10e+13):
    print(-1)
else:
    print(ans // 10e+5)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

M = 10 ** 18
Y = 1

for i in range(N):
    X = A[i]
    X = int(X)
    Y = Y * X
    if Y > M:
        break

if Y > M:
    print(-1)
else:
    print(Y)

Submission status: Wrong Answer

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

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

if Y > M:
    print(-1)
else:
    print(Y)

Submission status: Wrong Answer

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

  if 0 in a:
    print(0)
    return
  
  ans = a[0]
  a2 = a[1:]
  for i in a2:
    ans = ans * i
    if ans > 10e+18:
      print(-1)
      return

  print(ans)

main()

Submission status: Wrong Answer

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

ans = a[0]
a2 = a[1:]
for i in a2:
  ans = ans * i
  if ans > 1000000000000000000:
    ans = -1
    break

print(ans)

Submission status: Wrong Answer

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

ans = a[0]
a2 = a[1:]
for i in a2:
  ans = ans * i
  if ans > 10e+18:
    ans = -1
    break

print(ans)

Submission status: Wrong Answer

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

ans = a[0]
a2 = a[1:]
for i in a2:
  ans = ans * i

if ans > 10e+18:
  ans = -1

print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

print(sum(a))

Submission status: Wrong Answer

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

a=1
for i in range(N):
  a*=P[i]
  if(a>1000000000000000000):
    a=-1
    break
print(a)

Submission status: Wrong Answer

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

print(c)

Submission status: Wrong Answer

Solution code:
from math import log10
from functools import reduce
from operator import mul

N = int(input())

nums = [int(s) for s in input().rstrip().split()]

def product(nums):
  limit = 10**18
  result = 1
  for n in nums:
    if n == 0:
      return 0
    else:
      result *= n
    if result > limit:
      return -1
  return result
    
print(product(nums))

Submission status: Wrong Answer

Solution code:
from math import log10
from functools import reduce
from operator import mul

N = int(input())

nums = [int(s) for s in input().rstrip().split()]



def product(nums):
  logs = 0
  for n in nums:
    if n == 0:
      return 0
    else:
      logs += log10(n)
  if logs > 18:
    return -1
  else:
    return reduce(mul, nums)
    
print(product(nums))

Submission status: Wrong Answer

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

if K<=10**18 and K!=0:
    print(K)

Submission status: Wrong Answer

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

else:
    print(K)

Submission status: Wrong Answer

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

else:
    print(K)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
inp = input()
inp = input()
 
def mp(nums):
  n = 1
  limit = 10**18
  for num in nums:
    n *=num
    if n > limit:
      print(-1)
      return
  print(n)
 
mp([int(x) for x in inp.split(" ")])

Submission status: Wrong Answer

Solution code:
inp = input()
inp = input()

limit = 10**18
def mp(nums):
  n = 1
  for num in nums:
    n *=num
    if n > limit:
      print(-1)
      return
  print(n)

mp([int(x) for x in inp.split(" ")])

Submission status: Wrong Answer

Solution code:
inp = input()
inp = input()

limit= 10 ** 18

def mp(nums):
  n = 1
  for num in nums:
    n *=num
    if num > limit:
      print(-1)
      return
  print(num)
  return
 
mp([int(x) for x in inp.split(" ")])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
inp = input()
inp = input()
 
def mp(nums):
  n = 1
  limit= 10 ** 10
  for num in nums:
    n *=num
    if num > limit:
      print(-1)
      return
  print(num)
  return
 
mp([int(x) for x in inp.split(" ")])

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):
            mal=-1
            break
for j in range(0,len(n)):
    if(n[i]==0):
        mal=0
print(mal)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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 and n[i]==0):
            mal=-1
            break
    if(n[i]==0):
        mal=0
        break
print(mal)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
def main():

    N = int(input())
    lista = [int(x) for x in input().split()]
    q = 1
    for i in lista:
        q *= i
        if q > 10**18:
            print(-1)
            return
    print(q)


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 13 18:45:47 2020

@author: kawati
"""

N = int(input())

MAX = 10**18
ans = 1
a = list(map(int, input().split())) #mapでintにしつつinputで取得

for x in a:
    ans *= x
    if ans > MAX:
        print(-1)
        exit(0)
print(ans)

Submission status: Wrong Answer

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

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

print(ans)