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 numpy as np

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

if min(A)==0 or len(A) != N or ans > 10**18:
    print("-1")
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

Solution code:
N=int(input())
a=str(input())

def ans169(N:int, a:str):
    a_list=a.split()
    a_list=list(map(int,a_list))
    count=a_list[0]
    for i in range(1,N):
        count=count*a_list[i]
    if count>=10**18:
        return("-1")
    else:
        return(count)
print(ans169(N,a))

Submission status: Wrong Answer

Solution code:
N=int(input())
a=str(input())

def ans169(N:int, a:str):
    a_list=a.split()
    a_list=list(map(int,a_list))
    count=a_list[0]
    for i in range(1,N):
        count=count*a_list[i]
    if count>=1000000000000000000:
        return("-1")
    else:
        return(count)
print(ans169(N,a))

Submission status: Wrong Answer

Solution code:
N=int(input())
a=str(input())

def ans169(N:int, a:str):
    a_list=a.split()
    a_list=list(map(int,a_list))
    count=a_list[0]
    for i in range(1,N):
        count=count*a_list[i]
    if count>=1000000000000000000:
        return("-1")
    else:
        return(count)
print(ans169(N,a))

Submission status: Wrong Answer

Solution code:
N=int(input())
a=str(input())

def ans169(N:int, a:str):
    a_list=a.split()
    a_list=sorted(map(int,a_list))
    count=a_list[0]
    for i in range(1,N):
        count=count*a_list[i]
    if count>=1000000000000000000:
        return("-1")
    else:
        return(count)
print(ans169(N,a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 1
max_limit = 10 ** 18
for i in range(N):
  if ans * A[i] > max_limit:
    ans = -1
    break
  else:
    ans *= A[i]

print(str(ans))

Submission status: Wrong Answer

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

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

print(str(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

A=list(map(int,input().split()))
ans=A[0]
for cnt in range(N-1):
    ans = ans * A[cnt+1]
    if ans > 1000000000000000000:
        break
    elif ans == 0:
        break
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())

A=list(map(int,input().split()))
ans=A[0]
for cnt in range(N-1):
    ans = ans * A[cnt+1]
    if ans > 1000000000000000000:
        break
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if 0 in a:
    print(0)
    exit

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

Submission status: Wrong Answer

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

if 0 in a:
    print(0)
    exit

ans = 1
for n in a:
    ans *= n
    
    if ans > 10**18:
        ans = -1
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import decimal
n = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
  print(-1)
else:
  flag = True
  for i in a:
    ans *= i
    if ans >= (10 ** 18 + 1):
      print(-1)
      flag = False
      break
  if flag:
    print(ans)

Submission status: Wrong Answer

Solution code:
import decimal
n = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
  print(-1)
else:
  flag = True
  for i in a:
    ans *= i
    if ans > (10 ** 18 + 1):
      print(-1)
      flag = False
      break
  if flag:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

ans = 1

for item in A:
    ans *= item

    ans = min(ans, 10**18)

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 range(n):
    ans*=A[i]
    if ans > 10**18:
        break

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

Submission status: Wrong Answer

Solution code:
n = int(input())
aa = list(map(int, input().split()))
ans = 1
for a in aa:
  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()))
prod = 1

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

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

print(prod)

Submission status: Wrong Answer

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

for i in a:
    prod *= i

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

Submission status: Wrong Answer

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


    print(ans)

Submission status: Wrong Answer

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


    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 169 B
N = int(input())
A = list(map(int, input().split()))
ans = A[0]
tmp_ans = 0
for i in range(N):
    if len(str(A[i])) > 1:
        tmp_ans += (len(str(A[i])) -1)
        print(tmp_ans)


if tmp_ans > 18:
    print(-1)
else:
    for j in range(1, N):
        ans *= A[j]
    print(ans)

Submission status: Wrong Answer

Solution code:
# 169 B
N = int(input())
A = list(map(int, input().split()))
ans = A[0]
tmp_ans = 1
for i in range(N):
    if len(str(A[i])) > 1:
        tmp_ans += (len(str(A[i])) -1)
        print(tmp_ans)


if tmp_ans > 18:
    print(-1)
else:
    for j in range(1, N):
        ans *= A[j]
    print(ans)

Submission status: Wrong Answer

Solution code:
n,*a=map(int,open(0).read().split());z=1
for i in a:
 if i>1e18//z:z=-1;break
 z*=i
print(z)

Submission status: Wrong Answer

Solution code:
_,*a=map(int,open(0).read().split());z=1
for i in a:
 if i>=1e18/z:z=-1;break
 z*=i
print(0 if 0in a else z)

Submission status: Wrong Answer

Solution code:
_,*a=map(int,open(0).read().split());z=1
for i in a:
 if i > 1e18 / z:
  z=-1;break
 if not i:
  z=0;break
 z*=i
print(z)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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 ANS > 10 ** 18:
        ANS = -1
        break

print(ANS)

Submission status: Wrong Answer

Solution code:
from sys import stdin

N = int(stdin.readline())
A = list(map(int, stdin.readline().split()))

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

def check():
  ans = 1
  for i in range(n):
    ans *= a[i]
  return ans
p = check()
#print(p)
if p < 10 ** 18:
  print(p)
else:
  print(-1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
def check():
  ans = 1
  for i in range(n):
    ans *= a[i]
    if ans > 10**8:
      return -1
  return ans

print(check)

Submission status: Wrong Answer

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

ans = 1

if 0 in A:
  print(0)

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

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

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

ans = A[0]

for i in range(1, 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()))

ans = A[0]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(acc)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = [int(x) for x in input().split()]
num = 10**18
count = 0
for i in range(n):
	count *= nums[i]

if count < num:
	print(-1)
else:
	print(count)

Submission status: Wrong Answer

Solution code:
import sys
N = input()
num = [int(x) for x in input().split()]
multiply = 1

if (0 in num):
    print(0)
    sys.exit()

for i in num:
    multiply *= i
    if (multiply >= 10**18):
        print(-1)
        sys.exit()
if (0 < multiply and multiply < 10**18):
    print(multiply)

Submission status: Wrong Answer

Solution code:
N = input()
num = [int(x) for x in input().split()]
multiply = 1
for i in num:
    multiply *= i
if (multiply >= 10**18):
    print(-1)
else:
    print(multiply)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    flag=1
  else:
    continue

if flag==0:
  print(x)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
x=1
flag=0
A.sort()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    flag=1
  else:
    continue

if flag==0:
  print(x)

Submission status: Wrong Answer

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

if flag==0:
  print(x)

Submission status: Wrong Answer

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

if flag==1:
  print(x)
else:
  print("-1")

Submission status: Wrong Answer

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

if flag==1:
  print(x)
else:
  print(-1)

Submission status: Wrong Answer

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

if flag==1:
  print(x)
else:("-1")

Submission status: Wrong Answer

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

if flag==1:
  print(x)
else:("-1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 1
f = False
for i in range(n):
    ans *= x[i]
    if ans > 10**18:
        f = True
        break
    
if ans > 10**18:
    f = True
    
if(f):
    print(-1)
    
else:
    print(ans)

Submission status: Wrong Answer

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

ans = 1
if 0 in A:
    print(0)
    exit()
for a in A:
    ans *= a
    print(ans)
    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**9 + 7:
        ans %= 10 ** 9 + 7

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

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
res=1
flag=0
for i in a:
    res*=i
    if res==0:
        flag=1
        print(0)
        break
if flag==0:
    print(res)

Submission status: Wrong Answer

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

ans = 1
dotira = False

for x in p:
  ans = ans * x
  if ans > 10 ** 18:
    dotira = True
    break
if dotira:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

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

ans = 1
dotira = False

for x in p:
  ans = ans * x
  if ans > 10 ** 18:
    dotira = True
    break
if dotira:
  print(-1)
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    th = 10**18
    for a in A:
        ans *= a
        if ans > th:
            print(-1)
            return 
    print(ans if ans <= th else -1)

if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

Solution code:

_ = input()
N = [int(v) for v in input().split()]
s = 1
for n in N:
    s *= n
    if s > 10**18:
        break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 1

kMax = 10**18

for i in map(int, input().split()):
    ans *= i
    if ans > kMax:
        print(-1)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
array = list(map(int,input().split()))
product =  1
if 0 in array:
  print(0)
  exit()
for i in array:
  product *= i
  if product > 10**18:
    print(product)
    exit()
print(product)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
array = list(map(int,input().split()))
product =  np.prod(array)
if product <= 10**18:
  print(product)
else:
  print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

a = sorted(a, reverse=True)

multi = 1

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

print(multi)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#
# author Sidratul
#

from math import prod

if __name__ == '__main__':
    n = input()
    a = list(map(int, input().split(' ')))
    s = 1
    x = True
    for i in range(len(a)):
        s = s * a[i]
        if s > 10**18:
            print(-1)
            break
    print(s)

Submission status: Wrong Answer

Solution code:
#
# author Sidratul
#

from math import prod

if __name__ == '__main__':
    n = input()
    a = list(map(int, input().split(' ')))
    s = 1
    x = True
    for i in range(len(a)):
        s = s * a[i]
        if s > 10**18:
            print(-1)
            x = False
            break
    if x:
        print(s)

Submission status: Wrong Answer

Solution code:
#
# author Sidratul
#

from numpy import prod

if __name__ == '__main__':
    n = input()
    a = list(map(int, input().split(' ')))
    s = prod(a)
    if s > 10**18:
        print(-1)
    else:
        print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
s=list(map(int,input().split()))
ans=1
for i in s:
  ans*=i
  if ans>1000000000000000000:
    print('-1')
    exit()

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
s=list(map(int,input().split()))
ans=1
for i in s:
  ans*=i
  if ans>1000000000000000000:
    print('-1')
    break
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
s=list(map(int,input().split()))
ans=1
for i in s:
  ans*=i
  if ans>10e18:
    print('-1')
    break
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 *= a[i]
  if ans > 10**18:
    print(-1)
    exit()
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

c=1

for i in range(n):
    c*=a[i]
    if c>10**18:
        print('-1')
        sys.exit()
    else:
        continue

print(c)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
arr = str(input())
lst =[]
for i in arr.split():
    lst.append(i)
multi = 1
for i in lst:
    if int(i) > pow(10,18):
        print(-1)
        exit(0)
    else: multi *= int(i)
print(multi)

Submission status: Wrong Answer

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

ans = 1
for x in a:
  ans = ans * x
  ans %= 10**20

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:

n = int(input())
arr = list(map(int,input().split()))
res = 1
flag = 1
inf = int(1e18)
for i in range(n):
  res = res*arr[i]
  if(res > inf):
    flag = 0
    break

if(flag == 0):
  print(-1)
else:
  print(res)

Submission status: Wrong Answer

Solution code:
#b問題
n=int(input())
ans=1
a=list(int(y) for y in input().split())
# print(a)
if 0 in a:
    print(0)
else:
    for i in range(n):
        ans*=a[i]
        if ans>10**18:
            print(ans)
            break
    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 *= a[i]
    if ans > 10**18:
        break
if ans <= 10**18:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ans = np.prod(Alist)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

for i in range(N):
    if A[i] == 0:
        print(0)
        exit()

ans = A[0]
for i in range(1, N):
    ans *= A[i]
    print(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()))
s=1
for i in range(N):
    s*=A[i]
    if s>10**18:
        print(-1)
        exit()
print(s)

Submission status: Wrong Answer

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

for i in l:
    result *= i
    if result > 10**18:
        print('-1')
        exit()

print(result)

Submission status: Wrong Answer

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

judge = True
ans = 1

if 0 not in a:
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            judge = False
            break
        
if judge == True:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

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

judge = True
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        judge = False
        break
        
if judge == True:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)