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

Solution (Python):
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 ()

Solution (Python):
x=int(input())
y=list(map(int, input().split()))
z=1
if 0 in y:
  print(0)
  exit()

for i in range(x):
  z = z*y[i]
  if z > 10**18:
    z=-1
    break
print(z)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()

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

if 0 in A:
    print(0)
    exit()
    
upto = 10 ** 18
ans = 1
for num in A:
    ans *= num
    if ans > upto:
        print("-1")
        exit()
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
total = 1
if 0 in A:
  print(0)
  exit()
for i in range(N):
  total *= A[i]
  if total > 1e18:
    print(-1)
    exit()
print(total)

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

INF = 10**18 + 1
ans = 1
for a in A:
    ans *= a
    ans = min(ans, INF)
if ans == INF:
    print(-1)
else:
    print(ans)

Solution (Python):
def calc():
    n = int(input())
    a = list(map(int, input().split()))

    if 0 in a :
        print(0)
        return

    ans = 1
    for x in a:
        ans *= x
        if ans > 1000000000000000000:
            print(-1)
            return

    print(ans)


calc()

Solution (Python):


N=int(input())
L = [int(i) for i in input().split()]
ANS=1
flag=0
for i in range(N):
    if L[i]==0:
        print(0)
        flag=1
        break
if flag==0:
    for i in range(N):
        ANS=ANS*L[i]
        if ANS>=1000000000000000001:
            print(-1)
            break
        if i==N-1:
            print(ANS)

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

Solution (Python):


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

main()

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

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

Solution (Python):
def resolve():
	N = int(input())
	A = [int(i) for i in input().split()]
	if 0 in A:
		print(0); return
	A.sort()
	ans = 1
	for i in reversed(range(N)):
		ans *= A[i]
		if ans > 10**18:
			print(-1); return
	print(ans)

resolve()

Solution (Python):
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()

Solution (Python):
def main():
    n = int(input())
    A = list(map(int, input().split()))

    if 0 in A:
        return 0
    result = 1

    for x in A:
        result*=x
        if result>1000000000000000000:
            return -1
    return result
print(main())

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

Solution (Python):


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

def code(a):
    pro = 1
    if 0 in a:
        print(0)
    else:
        for i in a:
            pro *= i
            if pro > (10 ** 18):
                print(-1)
                return
        print(pro)

code(l)

Solution (Python):
import sys


def log(s):
    
    pass


def output(x):
    print(x, flush=True)


def input_ints():
    return list(map(int, input().split()))


def main():
    n = int(input())
    aa = input_ints()
    aa.sort()
    r = 1
    for a in aa:
        r *= a
        if r > 1000000000000000000:
            print(-1)
            return
    print(r)


main()

Solution (Python):
import sys

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

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

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

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

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

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

if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A.sort()
if A[0]==0:
    print('0')
    A.remove(0)
    exit()
prod=1
for i in A:
    prod=prod*i
    if prod>1e18:
        print('-1')
        exit()
else:
    print(prod)

Solution (Python):
def main():
    n = int(input())
    A = list(map(int, input().split()))

    if 0 in A:
        print(0)
        return

    ans = 1
    for item in A:
        ans = ans * item
        if ans > 1000000000000000000:
            print(-1)
            return

    print(ans)


main()

Solution (Python):
n,*a=map(int,open(0).read().split())
a.sort()
if a[0]==0:
  exit(print(0))
ans=1
for q in a:
  ans*=q
  if ans>10**18:
    print(-1)
    exit()
print(ans)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
L.sort()
M = 1
for i in L:
  M *= i
  if M > 10**18:
    M = -1
    break
print(M)

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

A.sort()

if A[0] == 0:
  print(0)
  exit()

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

Solution (Python):
N = int(input())
As = list(map(int,input().split()))
if 0 in As:
  ans = 0
else:
  ans = 1
  for A in As:
    ans *= A
    if ans > 10 ** 18:
      ans = -1
      break
print(ans)

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

Solution (Python):
from sys import stdin
input = stdin.readline
def main():
  n = int(input())
  a = list(map(int,input().split()))
  a.sort()
  if a[0] == 0:
    print(0)
    return
  ret = 1
  for i in a:
    ret *= i
    if ret > 10**18:
      print(-1)
      return
  print(ret)
main()

Solution (Python):
import sys

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

def solve():
    if 0 in l:
        return (0)
        sys.exit()

    x = 1
    for i in range(N):
        x = x * l[i]
        if x > (1000000000000000000):
            x = -1
            break

    return str(x)

print(solve())

Solution (Python):
import sys


N = input()


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



ans = 1
if 0 in A:
    print(0)
    sys.exit()


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

print(ans)

Solution (Python):
import numpy as np
threshold = 10**18
n = input()
list_ = list(map(int, input().split()))

ans = 1
if 0 in list_:
  print(0)
else:
  for i in list_:
    ans *= i
    if ans > threshold:
      ans = -1
      break
  print(ans)

Solution (Python):
t = int(input())
arr = [int(x) for x in input().split()]
n = 1
flag = True
if 0 in arr:
    print(0)
else:
    for i in range(t):
        n *= arr[i]
        if n > 10**18:
            flag = False
            break
    if flag:
        print(n)
    else:
        print(-1)

Solution (Python):
N = int(input())
mylist = list(map(int , input().split(" ")))
result = 1

if 0 in mylist:
    result = 0

else:
    for i in mylist:
        
        if result * i > 10 ** 18:
            result = -1
            break
        else:
            result *= i
            
print(result)

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


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

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

    print(sq)

Solution (Python):
N = int(input())
L = input().split()
 
 
def mult():
    if "0" in L:
        return 0
    else:
        a = 1
        for i in L:
            a = a * int(i)
            if a > 1000000000000000000:
                return -1
        return a
 
print(mult())

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

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

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
A.sort()
answer=1

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

Solution (Python):
n = int(input())
An = list(map(int, input().split()))
ans = 1

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

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

print(ans)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
n = int(readline())
a = list(map(int, readline().split()))
v = 1

if min(a) == 0:
  print(0)
else:
  for i in a:
    v *= i
    if v > 1000000000000000000:
      print(-1)
      break
  else:
    print(v)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
n = int(readline())
a = list(map(int, readline().split()))
a.sort()
v = 1
for i in a:
  v *= i
  if v > 1000000000000000000:
    print(-1)
    break
  elif v == 0:
    print(0)
    break
else:
  print(v)

Solution (Python):

def main():
    a = input()
    array = list(map(int, input().split()))

    sum = 1

    new_array = sorted(array)
    for i in range(len(new_array)):
        sum *= new_array[i]
        if (sum > 10**18 or sum == 0):
            break

    if (sum > 10**18):
        sum = -1

    print(sum)

if __name__ == "__main__":
    main()

Solution (Python):
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 ()

Solution (Python):
n = int(input())
arr = input().split()


def mult():
    if "0" in arr:
        return 0
    else:
        a = 1
        for i in arr:
            a = a * int(i)
            if a > 1000000000000000000:
                return -1
        return a

print(mult())

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
sum = 1
if 0 in a:
    sum = 0
for i in range(n):
    sum *= a[i]
    if(sum > 1e18):
        sum = -1
        break
print(sum)

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

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

hantei = 10 ** 18
kekka = 1
m.sort()
for x in range(n):
    kekka = kekka * m[x]
    if kekka > hantei:
        print("-1")
        exit()

print(kekka)

Solution (Python):
from bisect import*
from math import*

n=int(input())
arr=list(map(int,input().split()))
arr.sort(reverse=True)
ans=1
z=0
for x in arr:
	ans*=x
	if ans>1000000000000000000:
		z=1
		break
if 0 in arr:
	print("0")
else:
	if z==1:
		print("-1")
	else:
		print(ans)

Solution (Python):
n=int(input())
arr=sorted(list(map(int,input().split())))
if arr[0]==0:
  print(0)
else:
  ans=1
  for i in arr:
    ans*=i
    if ans>(1000000000000000000):
      ans=-1
      break
      
  print(ans)

Solution (Python):
N = int(input())
A = [int(_) for _ in input().split()]
LIMIT = 10 ** 18


def solve():
    if any([x == 0 for x in A]):
        return "0"

    ans = 1
    for a in A:
        ans *= a
        if ans > LIMIT:
            return "-1"
    return str(ans)


print(solve())

Solution (Python):
import sys
N = int(input())
A  = list(map(int,input().split()))
S = int(1)
for iter in range(len(A)):
    if A[iter] == 0:
        print(0)
        sys.exit(0)

for iter in range(len(A)):
    S *= A[iter]
    if S > 10**18:
        print(-1)
        sys.exit(0)
print(S)

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

Solution (Python):
import sys

num = int(input())
a = list(map(int, input().split()))
b = 1
if 0 in a:
    print(0)
    sys.exit()
for i in a:
  if b * i > 10 ** 18:
    print(-1)
    sys.exit()
  else:
    b *= i
print(b)

Solution (Python):
N = int(input())
nums = [i for i in map(int, input().split())]
nums.sort()
ans=1

for num in nums:
    ans = ans*num
    if ans>10**18:
        ans=-1
        break

print(ans)

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

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

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

main()

Solution (Python):
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 ()

Solution (Python):
_,*a=map(int,open(0).read().split())
a.sort()

ans=1

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

print(ans)

Solution (Python):
def resolve():
    _ = input()
    an = sorted(map(int, input().split()), reverse=True)

    ans = 1
    if an[-1] == 0:
        ans = 0
    else:
        for a in an:
            ans *= a
            if ans > 10 ** 18:
                ans = -1
                break
    print(ans)
    
if __name__ == '__main__':
    resolve()

Solution (Python):
def main():
    input()
    a = list(map(int, input().split()))
    ans = 1
    for el in a:
        if el == 0:
            print(0)
            return
    for el in a:
        ans *= el
        if ans > 1e18:
            print(-1)
            return
    else:
        print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    input()
    a = list(map(int, input().split()))
    ans = 1
    for el in a:
        if el == 0:
            print(0)
            return
    for el in a:
        ans *= el
        if ans > 1e18:
            print(-1)
            return
    else:
        print(ans)


if __name__ == "__main__":
    main()

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

    if 0 in A:
        print(0)
        return

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

    print(ans)

main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
 
A.sort()
rslt = A[0]
 
for a in A[1:]:
  rslt *= a
  if rslt > 10**18:
    print(-1)
    exit()
print(rslt)

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

limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
    result *= a
    if result > limit:
        print(-1)
        exit()
print(result)

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

limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
    result *= a
    if result > limit:
        print(-1)
        exit()
print(result)

Solution (Python):
N=int(input())
T=1e18
arr=[int(i) for i in input().split()]
A=1
for a in arr:
    A*=a
    if A<0:
        A=-1
    if A>T:
        A=-1
print(A)

Solution (Python):
N=int(input())
number=list(map(int,input().split()))
ans=1
if 0 in number:
    print(0)
    exit(0)
    
for i in range(N):
    ans *= number[i]
    if ans>1000000000000000000:
        print(-1)
        exit(0)
print(ans)

Solution (Python):
N=int(input())
number=list(map(int,input().split()))
ans=1
if 0 in number:
    print(0)
    exit(0)
    
for i in range(N):
    ans *= number[i]
    if ans>1000000000000000000:
        print(-1)
        exit(0)
print(ans)

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
else:
    pro = 1;
    ok = True
    for el in A:
        pro *= el
        if(pro > 1e18):
            ok = False
            break

    if ok: print(pro)
    else: print(-1)

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

flg=True
if 0 in list:
  print(0)
  flg=False
else:
  prod=1
  for a in list:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      flg=False
      break
if flg:
  print(prod)

Solution (Python):
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 ()

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

Solution (Python):
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 ()

Solution (Python):
n = int(input())
x = input().split()
a = 0
b = 1
if x.count('0') >= 1:
  print(0)
else:
  while a <= n - 1 and b <= 1000000000000000000:
    b = b * int(x[a])
    a += 1
  if b > 1000000000000000000:
    print(-1)
  else:
    print(b)

Solution (Python):
n = int(input())
arr = [int(x) for x in input().split()]

mxN = 10**18
if 0 in arr:
    print(0)
    exit()
    
mul = 1
for x in arr:
    mul*=x
    if mul > mxN:
        print(-1)
        exit()

print(mul)

Solution (Python):
N=input()
A=list(map(int,input().split()))
s=1
t=0
if 0 in A:
  print(0)
else:
  for x in A:
    s *= x
    if s>10**18:
      t += 1
      print(-1)
      break
  if t==0:
    print(s)

Solution (Python):
def cal():
    N=int(input())
    A=list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    ans=1
    for i in A:
        ans = i*ans
        if ans > 1000000000000000000:
            print(-1)
            return
    print(ans)

cal()

Solution (Python):
def main():
    n = int(input())
    l = list(map(int, input().split(' ')))
    l.sort()
    if l[0] == 0:
        print(0)
        return
    
    total = 1

    for i in l:
        total = total * i
        if (total > 1000000000000000000):
            print(-1)
            return
    
    print(total)

main()

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

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

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
if 0 in l:
  print(0)
  exit()
total = 1
for i in range(n):
  total *= l[i]
  if total > 10 ** 18:
    print(-1)
    exit()
print(total)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
if 0 in l:
  print(0)
  exit()
total = 1
for i in range(n):
  total *= l[i]
  if total > 10 ** 18:
    total = -1
    break
print(total)

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

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

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]  
A.sort(reverse=True)

if A[-1]==0:
  print(0)
  exit()
  
mul = A[0]
i = 1
while mul<=10**18 and i<N:
  mul*=A[i]
  i += 1
  
if mul>10**18:
  print(-1)
else:
  print(mul)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
total = 1
if 0 in a:
  print("0")
  exit()

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

print(total)

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

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

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

Solution (Python):
N = int(input())
A_list = list(map(int, input().split()))

ans = 1

for i in A_list:
    if i == 0:
        ans = 0

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

print(ans)

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

ans = 1

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

for i in a:
    ans *= i

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

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

Solution (Python):
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 ()

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

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

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
ans = 1

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

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

print(ans)

Solution (Python):
N=input()
S=input().split()
buf=-2
for n,i in enumerate(S):
  if i=="0":
    buf=0
if buf!=0:
  for n,i in enumerate(S):
    if n==0:
      buf=int(i)
    else:
      buf=buf*int(i)
    if buf>1000000000000000000:
      buf=-1
      break
print(buf)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
ans = 1

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

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

print(ans)

Solution (Python):
num = int(input())
input_data = list(map(int,input().split()))

for i in input_data:
	if i == 0:
		print(0)
		exit()

result = 1
for i in range(num):
	result = result * int(input_data[i])
	if pow(10, 18) < result:
		print(-1)
		exit()

print(result)

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

Solution (Python):
import sys

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

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
s = 1
for v in a:
    s *= v
    if s > 10**18:
        print(-1)
        exit()
print(s)

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

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

print(ans)

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

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

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

print(ans)

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 1
flag = False
for i in range(n):
    res *= a[i]
    if res > 1000000000000000000:
        print(-1)
        flag = True
        break
if not flag:
    print(res)

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

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

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

Solution (Python):
"""
from functools import reduce
from operator import mul

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

result = reduce(mul, A)
print(result if result <= 10**18 else -1)
"""
import sys

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

result = 1
for a in A:
    result *= a
    if result > 10**18:
        print(-1)
        sys.exit()
else:
    print(result)

Solution (Python):
"""
from functools import reduce
from operator import mul

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

result = reduce(mul, A)
print(result if result <= 10**18 else -1)
"""
import sys

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

result = 1
for a in A:
    result *= a
    if result > 10**18:
        print(-1)
        sys.exit()
else:
    print(result)

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

Solution (Python):
def mul2():
    n = int(input())
    a = list(map(int, input().split()))
    
    if 0 in a:
        return 0
    ans = 1
    for i in a:
        ans *= i
        if ans > 1000000000000000000:
            return -1
        
    return ans 
print(mul2())

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

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

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

    print(ans)

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

r = 1

for x in a:
    if(x == 0):
        print(0)
        exit(0)    

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
x=1
c=0
if a.count(0)>0:
    print(0)
else:
    for i in range(n):
        x=x*a[i]

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

        
    if c==0:
        print(x)

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

if 0 in a_li:
  print(0)
else:
  result = a_li[0]
  for i in range(1,n):
    result = result * a_li[i]
  
    if result > 10 ** 18:
      print(-1)
      break
    
  else:
    print(result)

Solution (Python):
N=int(input())
D=False
ans=1
List=list(map(int,input().split()))
if 0 in List:
  print(0)
else:
  for i in range(N):
    ans=ans*List[i]
    if ans>10**18:
      print(-1)
      D=True
      break
  if D==False:
    print(ans)

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

Solution (Python):
N = int(input())
ans = 1
INF = 10**18
*a, = map(int, input().split())

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

Solution (Python):
n = int(input())
lis = list(map(int,input().split()))
ans = 1
if 0 in lis:
  print(0)
  exit()
for num in lis:
  ans *= num
  if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Solution (Python):
def main():
    n = int(input())
    nums = list(map(int, input().split()))
    
    if 0 in nums:
        print(0)
        return
    
    mul = 1
    for i in nums:
        mul *= i
        if mul > 1000000000000000000:
            print(-1)
            return
        
    print(mul)
    
main()

Solution (Python):
def main():
    s = [input() for l in range(2)]
    N, A_dct, A = int(s[0]), {int(x): int(x) for x in s[1].split()}, [int(x) for x in s[1].split()]
    if 0 in A_dct:
        print(0)
    else:
        tmp = 1
        for k in A:
            tmp *= k
            if tmp > 10**18:
                tmp = -1
                break
        print(tmp)
    

if __name__ == '__main__':
    main()

Solution (Python):
N = input().split()

list = [int(x) for x in input().split()]

list.sort()

answer = 1

for a in list:
    answer = answer*a
    if answer == 0:
        break
    if answer > 10**18:
        answer = -1
        break
    else:
        continue

print(answer)

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