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 = list(map(int,input().split()))
sum = 1
for i in a:
  sum *= i
  if sum > 1e18:
  	print(-1)
  	exit()
print(sum)

Submission status: Wrong Answer

Solution code:
x = input()
t = int(x)
x2 = input()
n = list(map(int, x2.split(" ")))


def main():
  p = 1
  for v in range(t):
    p *= n[v]
    if (p > 10 **18):
      print("-1")
      return
  print(p)

main()

Submission status: Wrong Answer

Solution code:
x = input()
t = int(x)
x2 = input()
n = list(map(int, x2.split(" ")))


def main():
  p = 1
  for v in range(t):
    p *= n[v]
    if (p >= 10 **18):
      print("-1")
      return
  print(p)

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=1
l=list(map(int ,input().split()))
for i in range(n):
    ans=ans*l[i]
count=0    
ans1=ans
while ans1!=0:
    a=ans1%10
    count=count+1
    ans1//=10
if count>18:
    print("-1")
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    N = input()
    str_num = input()
    num_list = str_num.split()
    
    if '0' in num_list:
        print(0)
        return
    
    answer = 1
    for num in num_list:
        answer *=int(num)
        if answer > 10**8:
            answer = -1
            break

    print(answer)

main()

Submission status: Wrong Answer

Solution code:
def main():
    N = input()
    str_num = input()
    num_list = str_num.split()
    
    if '0' in num_list:
        print(0)
        return
    
    answer = 1
    for num in num_list:
        answer *=int(num)
        if answer > 10**8:
            answer = -1
            break

    print(answer)

Submission status: Wrong Answer

Solution code:
str_list_size = input()
str_num = input()
num_list = str_num.split()
list_size = int(str_list_size)

answer = 1
for i in range(0, list_size):
    answer *=int(num_list[i])
    if answer >= 10**18:
        answer = -1
        break

print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
str_num = input()
num_list = str_num.split()

answer = 1
for number in num_list:
    answer *=int(number)
    if answer >= 10**18:
        answer = -1
        break

print(answer)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import string
 
n = int(input())
a = list(map(int,input().split()))
res = 1
for i in range(n):
    res *= a[i]
    if(res>pow(10,18)):
      	break
 
if(res>pow(10,18)):
    print(-1)
else:
    print(res)

Submission status: Wrong Answer

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

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

res = np.prod(a)

if(res>pow(10,18) or res < 0):
    print(-1)
else:
    print(res)

Submission status: Wrong Answer

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

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

res = np.prod(a)

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

Submission status: Wrong Answer

Solution code:
#
import sys
import math
import numpy as np
import itertools

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

Submission status: Wrong Answer

Solution code:
import sys
N = input()
x = list(map(int,input().split()))
 
z = 1
if N == 0:
  print(0)
  sys.exit()
  
for a in x:
  z = a*z
  if z > 10**18:
    print(-1)
    sys.exit()
  
print(z)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

ans = 1


for i in range(n):
    ans = ans*x[0]
    if ans > 1000000000000000001:
        ans = -1
        break

for i in range(n):
    if x[i] == 0:
        ans = 0

print(ans)

Submission status: Wrong Answer

Solution code:
N = input()

ab = input( )

ab = ab.split()

if 0 in ab:
    print(0)


SUM = 1
for i in range(int(N)):
    SUM = SUM * int(ab[i])
    if (int(SUM) > 10 ** 18):
        print(-1)
        
print(SUM)

Submission status: Wrong Answer

Solution code:
def main():
    N = input()

    ab = input( )

    ab = ab.split()
    
    if 0 in ab:
        print(0)


    SUM = 1
    for i in range(int(N)):
        SUM = SUM * int(ab[i])
        if (int(SUM) < 10 ** 18):
            print(SUM)
        else:
            print(-1)
        
main()

Submission status: Wrong Answer

Solution code:
def main():
    N = input()

    ab = input( )

    ab = ab.split()
    
    if 0 in ab:
        print(0)


    SUM = 1
    for i in range(int(N)):
        SUM = SUM * int(ab[i])

    if (int(SUM) < 10 ** 18):
        print(SUM)
    else:
        print(-1)
        
main()

Submission status: Wrong Answer

Solution code:
def main():
    N = input()

    ab = input( )

    ab = ab.split()


    SUM = 1
    for i in range(int(N)):
        SUM = SUM * int(ab[i])

    if (int(SUM) < 10 ** 18):
        print(SUM)
    else:
        print(-1)
        
main()

Submission status: Wrong Answer

Solution code:
N = input()

ab = input( )

ab = ab.split()


SUM = 1
for i in range(int(N)):
    SUM = SUM * int(ab[i])

if (int(SUM) < 10 ** 18):
    print(SUM)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
N = input()

ab = input( )

ab = ab.split()


SUM = 1
for i in range(int(N)):
    SUM = SUM * int(ab[i])

if int(SUM) < 10 ** 18:
    print(SUM)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

Solution code:
N = input()

ab = input( )

ab = ab.split()

SUM = 1
for i in range(int(N)):
    SUM = SUM * int(ab[i])
    
if (int(SUM) < 10 ** 18):
    print(SUM)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
ans = np.prod(A)
if ans > 10e17:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
ans = np.prod(A)
if ans >= 10e17:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
N = input()

ab = input( )

ab = ab.split()

SUM = 1
for i in range(len(ab)):
    SUM = SUM * int(ab[i])
    
if (int(SUM) < 10 ** 18):
    print(SUM)
else:
    print(-1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

i = 1
total = all(i*list)
if total > 10**18:
    print(-1)
else:
    print(total)

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
a = list(map(int, input().split()))
limit = 10 ** 18
res = 1

for i in range(n):
    res *= a[i]
    if res > limit:
        print(-1)
        sys.exit()

print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
max = 10 ** 18
res = 0

for i in range(n):
    res *= a[i]
    if res > max:
        print(-1)
        sys.exit()

print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
max = 10 ** 18
res = 0

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

print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
max_value = 10**18
answer = 1
over = False
a = list(map(int, input().split()))

for i in range(N):
    answer *= a[i]
    if answer > max_value:
        over = True
        break

if not over:
    print(answer)
else:
    print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

n=int(input())
arr=list(map(int,input().split()))
ans=1
for i in range(n):
  ans *= arr[i]
  if math.log10(ans) > 18:
    print(-1)
    exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    for i in A:
        while T < 10:
            T *= i
            return T
        return -1
print(t())

Submission status: Wrong Answer

Solution code:
def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    for i in A:
        while T < 10:
            T *= i
            return T
        return -1
print(t())

Submission status: Wrong Answer

Solution code:
import sys 

input=sys.stdin.readline 

def main():
	n=int(input().strip())
	a=list(map(int,input().strip().split()))
	result =1
	LIMIT =10**18
	if 0 in a:
		print(0)
		sys.exit
	for i in a:
		result *=i
		if result >LIMIT:
			print(-1)
			sys.exit()
		print(result)

if __name__=='__main__':
	main()

Submission status: Wrong Answer

Solution code:
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS())

def main():
    GI()
    CEIL = 10 ** 18

    prod = 1
    for x in GIS():
        prod *= x
        if prod > CEIL:
            prod = -1
            break
    print(prod)

main()

Submission status: Wrong Answer

Solution code:
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS())

def main():
    CEIL = 10 ** 18

    prod = 1
    for x in GIS():
        prod *= x
        if prod > CEIL:
            prod = -1
            break
    print(prod)

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    while T < 10 ** 8:
        for i in A:
            T *= i
        return T
    return -1
print(t())

Submission status: Wrong Answer

Solution code:
def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    while T < 10 ** 8:
        for i in A:
            T *= i
            break
        return -1
t()

Submission status: Wrong Answer

Solution code:
def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    while T < 10 ** 8:
        for i in A:
            T *= i
    return T
t()

Submission status: Wrong Answer

Solution code:
def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    while T < 10 ** 8:
        for i in A:
            T *= i
t()

Submission status: Wrong Answer

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

t()

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
T = 1
for i in A:
    T *= i
print(T)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
T = 1
for i in A:
    T *= i

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
if np.min(a) ==0:
  print(0)
else:
  res = a.prod()
  res = -1 if res > 1000000000000000000  or res <= 0 else res
  print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
if a.min ==0:
  print(0)
else:
  res = a.prod()
  res = -1 if res > 1000000000000000000  or res <= 0 else res
  print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
if a.min ==0:
  print(0)
else:
  res = a.prod()
  res = -1 if res > 1000000000000000000  or res <= 0 else res
print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
if a.min ==0:
  print(0)
else:
  res = a.prod()
  res = -1 if res > 1000000000000000000 else res
print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
n = int(input())
a = list(map(int, input().split()))
res = 1 
if min(a) == 0:
  res = 0
else:
  a.sort(reverse=True)
  for i in range(n):
    res *= a[i]
    if res > 1000000000000000000:
      res = -1
      continue
print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
n = int(input())
a = list(map(int, input().split()))
res = np.prod(np.array(a))
if res > 1000000000000000000:
  res = -1
print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
n = int(input())
a = list(map(int, input().split()))
res = 1 
for i in range(n):
  res *= a[i]
if res > 0:
  res = -1 if math.log10(res) > 18 else res
print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
n = int(input())
a_n = map(int, input().split())
res = 1 
for a in a_n:
  res *= a
if res > 0:
  res = -1 if math.log10(res) > 18 else res
print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
a_n = map(int, input().split())
res = 1 
for a in a_n:
  res *= a
if res > 0:
  res = -1 if math.log10(res) > 18 else res
print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
a_n = map(int, input().split())
res = 1 
for a in a_n:
  res *= a
if res != 0:
  res = -1 if math.log10(res) > 18 else res
print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
a_n = map(int, input().split())
res = 1 
for a in a_n:
  res *= a
res = -1 if math.log10(res) > 18 else res
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
lst = list(map(int,input().split()))
res = 1
for i in lst:
    res *= i
if res >= 1000000000000000000:
    print(-1)
else:
    print(res)

Submission status: Wrong Answer

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

import numpy as np

N = int(input())

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

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

mul = A[0]

for i in A[1:]:
    if 1000000000000000000 / i < mul:
        print(-1)
        exit(0)
    mul *= i

print(mul)

Submission status: Wrong Answer

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

import numpy as np

N = int(input())

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

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

mul = np.prod(A)

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

Submission status: Wrong Answer

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

import numpy as np

N = int(input())

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

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

print(np.prod(A))

Submission status: Wrong Answer

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

import numpy as np

N = int(input())

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

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

if np.sum(A > 0) % 2 == 1:
    print(np.prod(A))
    exit(0)

mul = A[0]
for i in A[1:]:
    if 1000000000000000000 / i < mul:
        print(-1)
        exit(0)
    mul *= i

if mul > 1000000000000000000:
    print(-1)
    exit(0)

print(mul)

Submission status: Wrong Answer

Solution code:
import sys
N=int(input())
if N>10**5 or N<2:
    sys.exit()
a=input().split(' ')
if N<len(a):
    sys.exit()
s=1
for i in range(N):
    s*=int(a[i])
if s<10**18:
    print(s)
else:
    print("-1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
list_A = list(input().split())
list_A = [int(n) for n in list_A]
cal = 0
if 0 not in list_A:
    cal = np.prod(list_A,dtype='int64')
    if cal > 1000000000000000000:
        cal = -1
print(cal)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
list_A = list(input().split())
list_A = [int(n) for n in list_A]
cal = 0
if 0 not in list_A:
    cal = np.prod(list_A)
    if cal > 1000000000000000000:
        cal = -1
print(cal)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
list_A = list(input().split())
list_A = [int(n) for n in list_A]
cal = 0
if 0 not in list_A:
    cal = np.prod(list_A)
    if cal > 10e+18:
        cal = -1
print(cal)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
list_A = list(input().split())
list_A = [int(n) for n in list_A]
cal = np.prod(list_A)
if cal > 10e+18:
    cal = "-1"
print(cal)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
list_A = list(input().split())
list_A = [int(n) for n in list_A]
cal = np.prod(list_A)
if cal > 10e+18:
    cal = -1
print(cal)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
list_A = list(input().split())
list_A = [int(n) for n in list_A]
cal = np.prod(list_A)
if cal > 10e+8:
    cal = -1
print(cal)

Submission status: Wrong Answer

Solution code:
N = int(input())
list_A = list(input().split())
list_A = [int(n) for n in list_A]
#print(list_A)
cal = list_A[0]
for i in range(1,N):
    cal = cal * list_A[i]
if cal > 10e+8:
    cal = -1
print(cal)

Submission status: Wrong Answer

Solution code:
n = eval(input())
a = input().split()
prod = 0
for i in range(0, n):
    prod *= int(a[i])
if prod > 1e18:
    print(-1)
else:
    print(prod)

Submission status: Wrong Answer

Solution code:
a = input().split()
n = len(a)
prod = 0
for i in range(0, n):
    prod *= int(a[i])
if prod > 1e18:
    print(-1)
else:
    print(prod)

Submission status: Wrong Answer

Solution code:
_ = input()
nums = list(map(int,input().split()))
flg = True

ans = nums[0]
for num in nums[1:]:
  ans *= num
  if ans > 1e18:
    flg = False
    break
ans = ans if flg else -1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
Ai = input().split()
Ai = [int(Ai[k]) for k in range(int(N))]
K = Ai[0]
for j in range(int(N)):
  if Ai[j] == 0:
    K = 0
    print(0)
for i in range(1,int(N)):
  K = K * Ai[i]
  if K > 1000000000000000000:
    K = -1
    break
print(K)

Submission status: Wrong Answer

Solution code:
N = input()
Ai = input().split()
Ai = [int(Ai[k]) for k in range(int(N))]
K = Ai[0]
for j in range(int(N)):
  if Ai[j] == 0:
    print(0)
for i in range(1,int(N)):
  K = K * Ai[i]
  if K > 1000000000000000000:
    K = -1
    break
print(K)

Submission status: Wrong Answer

Solution code:
N = input()
Ai = input().split()
Ai = [int(Ai[k]) for k in range(int(N))]
K = Ai[0]
for j in range(int(N)):
  if Ai[j] == 0:
    print(K)
for i in range(1,int(N)):
  K = K * Ai[i]
  if K > 1000000000000000000:
    K = -1
    break
print(K)

Submission status: Wrong Answer

Solution code:
N = input()
Ai = input().split()
Ai = [int(Ai[k]) for k in range(int(N))]
K = Ai[0]
for i in range(1,int(N)):
  K = K * Ai[i]
  if K > 1000000000000000000:
    K = -1
    break
print(K)

Submission status: Wrong Answer

Solution code:
import sys

number = int(input())
box = list(map(int,input().split()))

overflow = 1e18
ans = 1
for var in box:
    if overflow/var < ans:
        print("-1")
        sys.exit()
    ans *= var

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

    total = 1
    for a in A:
        total *= a
        if total > 10 ** 18:
            print(-1)
            return

    print(total)


main()

Submission status: Wrong Answer

Solution code:
M = int(input())
N = input().split(' ')
if '0' in N:
    print(0)
else:
    check = False
    total = 0
    f = 0
    N = [int(i) for i in N]
    for i in N:
        if i == 0:
            continue
        total += len(str(i))-1
        if i / 10 ** (len(str(i)) - 1) != 1:
            f += i / 10 ** (len(str(i)) - 1)
        if total + len(str(f)) > 18:
            check = True
            break


    if check:
        print(-1)
    else:
        base = N.pop(0)
        for i in N:
            if i == 1:
                continue
            base *= i
        print(base)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

ans = 1

for a in A:
    if a == 0:
        print(0)
        sys.exit()

for a in sorted(A, reverse=True):
    ans *= a
    if 10**18 < ans:
        print(-1)
        sys.exit()


print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

ans = 1

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(sum)

Submission status: Wrong Answer

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

print(sum)

Submission status: Wrong Answer

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

for i in range(N):
    num *= As[i]
    
if num>10^18:
    num=-1

print(num)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

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

T = 1
for i in A:
    T = T * i
    if T > 10 ^ 18:
        print(-1)
    else:
        print(T)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for i in A:
    T = 1
    T = T *i
    if T > 10^18:
        print(-1)
    else:
        print(T)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in A:
    T = 1*i
    if T > 10^18:
        print(-1)
    else:
        print(T)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
A_N=[int(x) for x in input().split()]
ans=1
for A in A_N:
  ans = ans*A
  if ans>1000000000000000000:
    ans=-1
    break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
##169

##B
N = int(input())
A = list(map(int,input().split()))
ans = 1
i=0
if 0 in A:
  print(0)
else:
  while N > i:
    if ans <= 10**18:
        ans *= A[i]
        i += 1
    else:
        ans = -1
        break
  
if ans > 10**18:
    print(-1)
else:
    print(ans)