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: Runtime Error

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

    ans = 1
 
    for i in a:
        ans *= i
      	if ans > int(1e18): return -1
    
    
    return ans
    

print(solve())

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = 1 
x = 10 ** 18

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

for i in a:
  ans *= i
  if ans > x:
    print('-1')
  else:
    print(ans)

Submission status: Runtime Error

Solution code:
def demon():
  N = int(input())
  A = list(map(int,input().split()))
  A = sort(A)
  if A[0] == 0:
    print(0)
    return

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

  print(X)

demon()

Submission status: Runtime Error

Solution code:
from decimal import *
a,b = map(Decimal,input().split())
print(int(a * b))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
lines = input()
line = [int(i) for i in lines.split(' ')]
sum = 1
for i in line:
  if sum > 1.0 * 10^18:
    sum = -1
    break
   else:
    sum = sum * i
print(sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=input()
b=map(int , input().slice())
c=1
for i in range(1,n):
  c=c*b[i]
  
print(c)

Submission status: Runtime Error

Solution code:
str = input().split()
num_list = []
for i in str:
  num_list.append(int(i))

ans = num_list[0]
LIMIT_NUM = 10**18
for i in range(1,len(num_list):
  ans *= num_list[i]

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

Submission status: Runtime Error

Solution code:
from sys import stdin

def main():
  read = stdin.readline
  N = int(read())
  data = list(map(int,read().split(" ")))
  ans = 1
  for i in data:
    if ans > 10**18/i:
      print("-1")
    else:
      ans *= i
      
    
  print(ans)
  
  
if __name__ == "__main__":
  main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b=map(int and float ,input().split())
b=100*b
c=a*b
print(int(c/100))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

t=[]
for i in range(N):
  t.append(int(input()))
P = t[0]
for i in range(len(t)-1):
  P = P*t[i+1]
  print(P)
if P <= 10**18:
  print(P)
else:
  print('-1')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())

a = [int(x) for x in input().split() if x != "1"]
sum = a[0]

if 0 in a:
        sum = 0
else:
    for i in range(1,len(a)):
        sum = sum * a[i]
        if sum > 10**18:
            break
        


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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

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

    if 0 in A:
        print(0)

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

    print(prod)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main ():
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    return

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

    print(prod)
main ()

Submission status: Runtime Error

Solution code:

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

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

print(prod)

Submission status: Runtime Error

Solution code:

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

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

print(prod)

Submission status: Runtime Error

Solution code:

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

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

print(prod)

Submission status: Runtime Error

Solution code:

n,*a=map(int,input().split)

val=1
for x in a:
    val*=x

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

Submission status: Runtime Error

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

for i in range(n):
  if(res > pow(10,18)):
    res = -1
    break
  else:
    res = res * a[i]
print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=int(input())
ans=1;
ok=True
for i in range(a):
    c=int(input())
    ans*=c
    if ans>10**18:
        ans=-1
        break
print(ans)

Submission status: Runtime Error

Solution code:
a=input()
ans=1;
ok=True
for i in range(a):
    c=input()
    ans*=c
    if ans>1000000000000000000:
        ok=False
        break
if ok:
    print(ans)
else :
    print(-1)

Submission status: Runtime Error

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

main()

Submission status: Runtime Error

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

main()

Submission status: Runtime Error

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

cumul = 1
if 0 in nums: print(0)
else:
	for i in range(N):
    	cumul *= nums[i]
		if cumul > 10 ** 18:
      		print(-1)
      		break
	if cumul <= 10 ** 18: print(cumul)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

cumul = 1
for i in range(N):
    cumul *= nums[i]

if cumul > 10 ** 18: print(-1)
elif:print(cumul)

Submission status: Runtime Error

Solution code:
N = input()
ans = 1
for _ in range(N):
  a = int(input())
  ans *= a
ans = -1 if ans > 10 ** 18 else ans
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

if cumul < 10**18: print(cumul)

Submission status: Runtime Error

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

for 0 in A :
	print(0)
	return

prod=1

for a in A:
	prod=prod*a

	if(prod > 1000000000000000000):
		print(-1)
		return

print(prod)

main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
a=int(input())
list=[]
for i in range(a):
    list.append(int(input()))

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
rint('何個の整数をかけますか')
a=int(input())
seki=1
for i in range (a):
    num=int(input())
    seki=seki*num

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

Submission status: Runtime Error

Solution code:
n =int(input())
limit = 10**18
re =0

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

l.sort()

if(l[0]) != 0):
  for i in l:
    re *= i
    if(re > limit):
      print(-1)
      exit()

print(re)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
mul = 1
lst = [map(int.input().split())]
for ele in lst:
  mul = mul *ele
if(mul > 1e18):
  print(-1)
else:
  print(mul)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main()
	n = int(input())
  	arr = list(map(input().split()))
    if 0 in arr:
        print(0)
        return
    prod = 1
    for x in arr:
        prod *= x
        if prod > int(1e18):
            print(-1)
            return
    print(prod)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main()
	n = input()
  	arr = list(map(input().split()))
    if 0 in arr:
        print(0)
        return
  	prod = 1
    for x in arr:
        prod *= x
        if prod > int(1e18):
            print(-1)
            return
    print(prod)

if __name__ = "__main__":
	main()

Submission status: Runtime Error

Solution code:
def main()
	n = input()
  	arr = list(map(input().split()))
    if 0 in arr:
        return print(0)
  	prod = 1
    for x in arr:
        prod *= x
        if prod > int(1e18):
            return print(-1)
    print(prod)

if __name__ = "__main__":
	main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

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

if 0 in a:
    print(0)
else:
    cur = 1
    for x in a:
        cur *= a
        if cur > 10 ** 18:
            print(-1)
            sys.exit()
        print(cur)

Submission status: Runtime Error

Solution code:
import numpy as np

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

if 0 in l:
    result = 0
else:
    arr = np.asarray(l)
    p = np.prod(arr)

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

print(p)

Submission status: Runtime Error

Solution code:
import sys

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

cur = 1
for x in a:
    cur *= a
    if cur > 10 ** 18:
        print(-1)
        sys.exit()
print(cur)

Submission status: Runtime Error

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

main()

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if 1*(10**18)+1<=total:
  print("-1")
else:
  print(total)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

Solution code:
lim = 1e18

n = int(input())

l = list(map(int,intput().split()))
ans = 1
f = 0
for x in l:
	ans *= x
	if ans > lim:
		print("-1")
		f = 1
		break
if f == 0:
	print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
arr = [ int(x) for x in input().strip().split(' ') ]
isZ = False
for x in arr:
    if x == 0:
        isZ = True

if isZ:
    print ("0")
    exit(0)

res = 1
for x in arr:
    res *= x
    if res > 1000000000000000000:
        print ("-1")
        exit(0)
p

Submission status: Runtime Error

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

if 0 in A:
  print(0)
  return

count = 1
for i in A:
  count *= i
  if count > 10000000000000000000:
    print(-1)
    return

print(count)

Submission status: Runtime Error

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

if 0 in A:
  print(0)
  return

count = 1
for i in A:
  count *= a
  if count > 10000000000000000000:
    print(-1)
    return

print(count)

Submission status: Runtime Error

Solution code:
import sys

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

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

print(ans)

Submission status: Runtime Error

Solution code:
#include <iostream>
using namespace std;

int main ()
{
	long n, a;
	long ret = 1;
	bool flag = true;

	cin >> n;

	for (int i=0; i<n; i++) {
		cin >> a;
		if (a == 0) {
			cout << 0 << endl;
			return 0;
		}
		ret *= a;
		if (ret <= 0 || 1000000000000000000 < ret) {
			flag = false;
		}
	}

	if (flag == false) {
		cout << -1 << endl;
	} else {
		cout << ret << endl;
	}

	return 0;
}

Submission status: Runtime Error

Solution code:
N=int(input())
result=1
A=input().split()
for j in range(N):
  result=result*int(A[j])
  if(result>10**18):
    print(-1)
    return
print(result)

Submission status: Runtime Error

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

product = 1
broken = False
for i in range(N):
  product *= A[i]
  if product > 10 ** 18:
    print("-1")
    broken = True
    break
if not broken:
  print(product)

Submission status: Runtime Error

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

product = 1
broken = False
for i in range(N):
  product *= A[i]
  if product > 10 ** 18:
    print("-1")
	broken = True
    break
if not broken:
  print(product)

Submission status: Runtime Error

Solution code:
N=int(input())
A=[]
result=1
for i in range(N):
  A.append(int(input().split()))
for j in range(N):
  result=result*A[j]
if(result>10**18):
  print(-1)
else:
  print(result)

Submission status: Runtime Error

Solution code:
N=int(input())
A=[]
result=1
for i in range(N):
  A.append(int(input()))
for j in range(N):
  result=result*A[j]
if(result>10**18):
  print(-1)
else:
  print(result)

Submission status: Runtime Error

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

mult = 1
for i in values:
  mult *= i
  if mult > 1000000000000000000:
    print(-1)
    return

print(mult)

Submission status: Runtime Error

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

for i in range(N):
    cnt *= A[i]
    if(cnt > 1e18):
	print(-1)
	sys.exit()

if(cnt <= 1e18):
    print(cnt)
else:
    print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
line=map(int,input().split(" "))
for i in line:
  if i==0:
    print("0")
    return
g=1
for i in line:
  g=g*i
  if g>10**18:
    print("-1")
    return
print(g)

Submission status: Runtime Error

Solution code:
import psyco
psyco.full()

n = int(input())
values = input().split()
mult = 1

for i in range(len(values)):
  mult *= int(values[i])
  if mult > 10**18:
    mult = -1
    break
    
print(mult)

Submission status: Runtime Error

Solution code:
int1 = input() #iを取得し、intに値を入れる
int2 = input().split(" ")
result=1

for i in int2:
    if i == 0:
        result = 0
        break
    else:
        result= result * i
        if result >= 10^18:
            result=-1
            break


print(result)

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 1
for i in range(n):
  x = int(input())
  ans *= x
print(ans if ans <= 1e18 else 0)

Submission status: Runtime Error

Solution code:

N=int(input())
A=list(map(int,input().split()))
m=1
A=A.sort()
for x in A:
	m*=x
    
if(m>10**18):
  print('-1')
  
else:
  print(m)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
A=[input() for _ in range(N)]
m=1
for x in A:
	m*=x
    
if(m>10**18):
  print('-1')
  
else:
  print(m)

Submission status: Runtime Error

Solution code:
#TIME : 
import sys
from math import sqrt
input = sys.stdin.readline

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

MAX = 10**18
n = inp()
a = inlt()
if 0 in A:
    print(0)
    exit()
res = 1
for num in a:
    res*=num
if res > MAX:
    print(-1)
else:
    print(res)

Submission status: Runtime Error

Solution code:
_, *a = map(int, open(0).read.split())
ret = 1
for x in sorted(a):
  ret *= x
  if ret > 10**18:
    ret = -1
    break
print(ret)

Submission status: Runtime Error

Solution code:
_, *a = map(int, open(0).read.split())
ret = 1
for x in a:
  ret *= x
  if ret > 10**18:
    ret = -1
    break
print(ret)

Submission status: Runtime Error

Solution code:
_, *a = map(int, input().split())
ret = 1
for x in a:
  ret *= x
  if ret > 10**18:
    print(-1)
    return

print(ret)

Submission status: Runtime Error

Solution code:
def main():
    from decimal import Decimal
    import numpy as np
    _=input()
    lis = np.array(list(map(Decimal,input().split())))
    lis=sorted(lis)

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

main()

Submission status: Runtime Error

Solution code:
from decimal import Decimal
import numpy as np
_=input()
lis = np.array(list(map(Decimal,input().split())))
lis=sorted(lis)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
li = input().split(" ")
x = 1
if 0 in li:
    print(0)
else:
    for i in li:
        x = x * i
        if x > 10**18:
            print(-1)
            exit()
    print(x)

Submission status: Runtime Error

Solution code:
n = int(input())
list = input().split(" ")
x = 1
if 0 in list:
  print(0)
else:
  for i in list:
    x = x * i
    if x > 10**18:
      print(-1)
      exit()
  print(x)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=A[0]
for k in A[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

x=1

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def main ():
	N = int(input())
	A = list(map(int,input().split()))
	if 0 in A:
    	print (0)
		return

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

main ()

Submission status: Runtime Error

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

    if 0 in A:
        print(0)
        return

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

print(prod)

main()

Submission status: Runtime Error

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

    if 0 in A:
        print(0)
        return

prod = 1
for a in A:
    prod *= a
    if prod > 10000000000000000000:
        print(-1)
        return

print(prod)

main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
inputs = input().split(" ")
decimal = int(float(inputs[1])*100)
product = int(inputs[0])*(decimal)
print(product//100)

Submission status: Runtime Error

Solution code:
n = int(input())
ls = list(map(int, input().split()))
if 0 in ls:
  print(0)
  return
ans = 1
for l in ls:
  ans *= l
  if ans > 1000000000000000000:
    print(-1)
    return
print(ans)

Submission status: Runtime Error

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