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())
    lista = [int(x) for x in input().split()]
    q = 1
    if 0 in lista:
        return print(0)
    for i in lista:
        q *= i
        if q > 10**18:
            print(-1)
            return
    print(q)


main()

Solution (Python):

"""
Created on Sat Jun 13 18:45:47 2020

@author: kawati
"""

N = int(input())

MAX = 10**18
ans = 1
a = list(map(int, input().split())) 

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


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

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

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

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

print(ans)

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

  if 0 in A:
    return 0

  r, max = 1, 10 ** 18
  for num in A:
    r *= num
    if r > max:
      return -1
  return r

print(main())

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

  if 0 in A:
    print(0)
    return

  r, max = 1, 10 ** 18
  for num in A:
    r *= num
    if r > max:
      print(-1)
      return
  print(r)

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())
a = list(map(int, input().split()))
if 0 in a:
  print(0)
else:
  s = 1
  for i in a :
    s *= i
    if s > 10**18:
      s = -1
      break
  print(s)

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

Solution (Python):
import sys

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

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

ans = 1
for a in a_list:
    ans = ans * a
    if ans > 1000000000000000000:
        print(-1)
        sys.exit()
print(ans)

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

    print(answer)

main()

Solution (Python):

def main():
  N = int(input())
  nl = list(map(int,input().split()))

  if 0 in nl:
    print(0)
    return

  ans=1
  lim=10**18

  for i in nl:
    ans *= i
    if ans>lim:
      print(-1)
      return
    
  print(ans)
  
main()

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

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

print(ans)

Solution (Python):
"""
~~ Author : Bhaskar
~~ Dated : 13~06~2020
"""

import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque

INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize) - 1
mod = 1000000007
ch = "abcdefghijklmnopqrstuvwxyz"
lcm = lambda a, b: (a * b) // gcd(a, b)
setbit = lambda x: bin(x)[2:].count("1")
INT = lambda type: type(sys.stdin.readline()) if type in [int, float] else type(sys.stdin.readline()).replace("\n", "")
ARRAY = lambda type: list(map(type, sys.stdin.readline().split()))
NUMS = lambda type: map(type, sys.stdin.readline().split())


def solve():

    n = INT(int)
    a = ARRAY(int)
    if 0 in a:
        print(0)
    else:
        p = 1
        ok = False
        for i in a:
            p *= i
            if p > 10**18:
                ok = True
                break
        print(p if not ok else -1)



if __name__ == "__main__":
    
    
    
    
    solve()

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 range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        sys.exit()
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 range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        sys.exit()
print(ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
ans = 1
Flag = True
zero_flag = False
for i in range(N):
    if A[i]==0:
        zero_flag = True
        break
for i in range(N):
    ans = ans*A[i]
    if ans > 10**18:
        Flag = False
        break
        

if zero_flag:
    print(0)
elif ans<=10**18 or Flag:
    print(ans)
else:
    print(-1)

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

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

Solution (Python):
def main():
    n = int(input())
    data = input().split()
    
    for i in range(n):
        data[i] = int(data[i])
        if data[i] == 0:
            print(0)
            return
        
    res = 1
    for i in range(n):
        res *= data[i]
        if res > 10**18:
            print(-1)
            return
    print(res)
    return

if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys

max = 10**18

n = int(input())
a = [int(x) for x in input().split()]
if 0 in a:
  print(0)
  sys.exit()

ans = 1

for num in a:
  ans *= num
  if ans > max:
    ans = -1
    break
print(ans)

Solution (Python):
n = int(input())
num = [int(i) for i in input().split()]

cont=0
ans=1

for j in num:
    if j == 0: cont+=1

if cont > 0: print(0)
else:
    for i in num:
        ans=ans*i
        if ans>1e18:
            ans=-1
            break
    print(ans)

Solution (Python):
def main():
    _ = input()
    a = list(map(int, input().split()))

    result = 1
    for a_i in a:
        if a_i == 0:
            return 0

    for a_i in a:
        result *= a_i

        if 10**18 < result:
            return -1

    return result


if __name__ == '__main__':
    result = main()
    print(result)

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

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

    print(ans)

Solution (Python):
wfwfe=input()
check=0
b=input().split()
if "0" in b:
    print (0)
else:
    
    count=1
    for i in b:
        count=count*int(i)
        
        if count>10**18:
            print (-1)
            check=1
            break
    if check==0:
        print (count)

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

ans = 1
if 0 in nums:
  print(0)
else:
  for n in nums:
    ans *= n
    if ans > 10**18:
      print(-1)
      break
  if ans <= 10**18: print(ans)

Solution (Python):
def main():
    num = int(input())
    suzi = list(map(int,input().split()))

    if 0 in suzi:
	    print(0)
	    return
    ans = 1
    for kazu in suzi:
        ans *= kazu
        if ans > 1000000000000000000:
            print(-1)
            return
    print(ans)


main()

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

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

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

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

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    arr = list(map(int, input().split()))
    product = arr[0]
    if 0 in arr:
        product = 0
    else:
        for i in range(1, n):
            product *= arr[i]
            if product > (10**18):
                product = -1
                break
    print(product)

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

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

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

def f(x):
  x.sort()
  if x[0]==0:
    return 0

  x.sort(reverse=True)
  
  ans=1
  
  for i in a:
    ans=ans*i

    if ans>10**18:
      return -1
      
  return ans
  


print(f(a))

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

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

if 0 in arr:
  print(0)
else:
  p = 1
  for i in arr:
    p *= i
    if p>1000000000000000000:
      p = -1
      break
  print(p)

Solution (Python):
tukawan = int(input())
A = list(map(int, input().split())) 
result = 1

if 0 in A:
    print(0)

else:
  for number in A:
    result = result * number
    
    if result > 1000000000000000000:
      result = -1
      break
    
  print(result)

Solution (Python):

    

n = int(input())

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

Solution (Python):
n = int(input())
L = list(map(int,input().split()))
ans = 1
L.sort()
for l in L:
  ans *= l
  if ans > 10**18:
    print("-1")
    quit()
print(ans)

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
res=1
if 0 in a:
  print("0")
else:
  for x in a:
    res=res*x
    if(res>1000000000000000000):
      res=-1
      break
  print(res)

Solution (Python):
N = int(input())
l = [int(x) for x in input().split()]

if 0 in l:
    ans = 0
else:
    n = min(N,len(l))
    ans = 1
    for i in l[:n]:
        ans *= i
        if ans > 10**18:
            ans = -1
            break
print(ans)

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

Solution (Python):
import sys
N=int(input())
a=list(map(int,input().split()))
for i in a:
  if i==0:
    print(0)
    sys.exit()
    
ans=1
for i in a:
  ans*=i
  if 1e18<ans:
    print("-1")
    sys.exit()
  
print(ans)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
list.sort(A,reverse=True)
if A[-1]==0:
  print(0)
  exit()
ans=A[0]
for i in range(1,len(A)):
  ans*=A[i]
  if 10**18<ans:
    print(-1)
    exit()
print(ans)

Solution (Python):
lenght = int(input())
 
x = list(map(int,input().split()))
x.sort(reverse=True)
check = False

if x[-1]==0:
  print(0)
else:
  first_value = 1
  for val in x:
    first_value *= val
    if first_value > 1e18:
      check=True
      break
  if check:
    print(-1)
  else:
  	print(first_value)

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

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

A.sort()

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

print(ans)

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

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

Solution (Python):
if __name__ == "__main__":
    n = int(input())

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


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

    sorted_a = sorted(a, reverse=True)

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

    print(ans)

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

Solution (Python):



from collections import deque

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

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

for i in range(N - 1):
    ans *= A.popleft()
    if ans > pow(10, 18):
        print(-1)
        exit()
else:
    print(ans)

Solution (Python):
N = int(input())

A=[int(i) for i in input().split()]

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

Solution (Python):
N = int(input())

A=[int(i) for i in input().split()]

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

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

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

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

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

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

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

    print(multi)

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

"""
ans = 1
for x in range(N):
    ans *= A[x]
"""
A = sorted(A)

ans = 1
for x in A:
    ans *= x
    if ans == 0 or ans > 1.0e+18:
        break


if ans > 1.0e+18:
    print(-1)
else:
    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 > 1000000000000000000:
            print(-1)
            return
    print(ans)
main()

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

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

Solution (Python):


import sys

N = int(input())
A = [int(s) for s in input().split()]

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

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

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

Solution (Python):
def main():
  N = int(input())
  A = [int(ai) for ai in input().split()]
  
  if 0 in A:
    print(0)
    return
  
  ans = 1
  for ai in A:
    ans *= ai
    if ans > 1e18:
      print(-1)
      return
  print(ans)

main()

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

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

b=1
for i in range(0,N):
    b *= a[i]
    if b > 1000000000000000000:
        print(-1)
        sys.exit()

print(b)

Solution (Python):
import sys

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

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

for e in a:
    sum_a *= e
    if sum_a > 1e18:
        print(-1)
        sys.exit()

if sum_a > 1e18:
    sum_a = -1

print(sum_a)

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

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

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

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

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

    if a.count(0) >= 1:
        print(0)
        return

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

if __name__ == "__main__":
    main()

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

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
A = 1
if 0 in a:
  print(0)
  exit()
for i in range(N):
  A = A * a[i]
  if A > 1000000000000000000:
    print(-1)
    exit()
print(A)

Solution (Python):
size = int(input())

A = input()
B = []
for i in A.split():
    B.append(int(i))

if min(B) == 0:
    mul = 0
else:
    mul = 1
    for i in range(len(B)):

        mul *= B[i]

        if mul > 10**18:
            mul = -1
            break

print(mul)

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

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

Solution (Python):
from sys import stdin
MAX = 10**18

def main():
    line_count = 0

    for line in stdin:
        line_count += 1
        factors_str = line.split()
        if line_count == 2:
            break

    factors = [int(factor) for factor in factors_str]
    
    if 0 in factors:
        print(0)
        return

    product = 1
    for factor in factors:
        product *= factor
        if product > MAX:
            print(-1)
            return

    print(product)

main()

Solution (Python):
N = int(input())
A = input().split()
A = [int(a) for a in A]
A.sort()
MAX = 10**18
res = 1
for i in range(N):
    res *= A[i]
    if res > MAX:
        res = -1
        break
print(res)

Solution (Python):
import sys
n = int(input())
a = [int(i) for i in 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):
n = int(input())
a = list(map(int, input().split()))
p = 10**18
a.sort()

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

a.reverse()

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

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):
import math
 
N = int(input())
x_list = list(map(int, input().split()))
 
result = 1
if 0 in x_list:
  print(0)
  exit()
for x in x_list:
  result *= x
  if result > 1e18:
    print(-1)
    exit()
print(result)

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

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

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

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
p = 1
for i in a: 
    if i==0:
        print(0)
        exit(0)
for i in a:
    p*=i
    if p>10**18:
        p=-1
        break
print(p)

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

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

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

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

sum = 1
A.sort()
for i in A:
  sum = sum * i
  if sum > pow(10, 18):
    sum = -1
    break
print(sum)

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

a.sort()

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

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

Solution (Python):
p=int(input())
ans=1
ar=list(map(int,input().split()))
if 0 in ar:ans=0
else:
    for i in range(p):
        if ans<1e18:ans*=ar[i]
        else:ans=-1;break
if ans>1e18:ans=-1
print(ans,end='')

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):
INF=10**18
n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
for val in a:
	ans*=val
	if val==0:
		print(0)
		exit()
	if ans>INF:
		print(-1)
		exit()
else:
	print(ans)

Solution (Python):
import numpy as np

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

FLAG = True
if(min(A) == 0):
    prod = 0
else:
    prod = 1
    for a in A:
        prod *= a
        if(prod > 1000000000000000000):
            print(-1)
            FLAG = not FLAG
            break

if FLAG:
    print(prod)

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)
        break
else:
    print(ans)

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

Solution (Python):
import sys

n = int(input())
a = [int(i) for i in input().split()]
x = 1
if 0 in a:
    print(0)
    sys.exit()

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

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

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

Solution (Python):
def main():

	N, *d = map(int, open(0).read().split())

	if 0 in d:
  		print(0)
  		return

	A = 1
	for O in d:
		A *= O
		
		if A > 1000000000000000000:
			print(-1)
			return

	print(A)

main()

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

sum = 1
A.sort()
for i in A:
    sum = sum*i
    if sum > pow(10,18):
        sum = -1
        break
print(sum)

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

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

print(ans)

Solution (Python):
import functools
n = int(input())
arr = [int(a) for a in input().split()]
m = 10 ** 18

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

Solution (Python):
th = 10**18

N = int(input())
A = sorted([int(i) for i in input().split()])

res = 1

for v in A:
    res *= v
    if res > th:
        print(-1)
        quit()
print(res)

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

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

Solution (Python):
def main ():
  count = int(input())
  c = list(map(int,input().split()))

  if 0 in c:
    print(0)
    return

  result = 1
  for a in c:
    result *= a
    if result > 1000000000000000000:
      print(-1)
      return

  print(result)

main()

Solution (Python):
def main():
  
	n = int(input())
	a = list(map(int,input().split()))
	uppest = pow(10 , 18)

	ans = 1

	if 0 in a:
  		print (0)
  		return

	for s in a:
	  	ans *= s
  		if ans > uppest:
    			print(-1)
    			return
  
	print(ans)

main()

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

ans = 1

import sys

if 0 in A:
  print(0)
  sys.exit()
  
for a in A:
  ans *= a
  if ans > pow(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
    prod = 1 
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1) 
            return
    print(prod) 

main()

Solution (Python):
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  if flag == 1:
    sum = sum * num
    if sum > upper:
      flag = 2
  if num == 0:
    flag = 0
    break
if flag == 2:
  print(-1)
else:
  print(sum * flag)

Solution (Python):
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  if num == 0:
    sum = 0
    flag = 1
    break
  if flag == 1:
    sum = sum * num
    if sum > upper:
      flag = 2

if flag == 1:
  print(sum)
elif flag == 2:
  print(-1)

Solution (Python):
n = int(input())
lists = list(map(int, input().split()))
number = 1
if 0 in lists:
  number = 0
else:
  for j in lists:
    number = number * j
    if number > 10 ** 18:
      number = -1
      break
print(str(number))

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

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

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

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

Ans = 1
for i in range(0,len(A)):
    Ans *= A[i]
    if Ans > 10**18:
        print(-1)
        exit()
    else:
        continue
print(Ans)

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

print(ans)

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

print(ans)

Solution (Python):
import sys

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
if(A[-1] == 0):
  print(0)
else:
  p = 1
  for An in A:
    p *= An
    if(p > 10 ** 18):
      print(-1)
      sys.exit()
  print(p)

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

Solution (Python):
N = int(input())
A = sorted([int(i) for i in input().split()])

P = 1
c = 0

for c in range(N):
  if P * A[c] <= 10**18:
    P *= A[c]
  else:
    P = -1
    break
print(P)

Solution (Python):
import sys


from sys import stdin,stdout
from collections import deque,defaultdict
from math import ceil,floor,inf,sqrt,factorial,gcd,log2
from copy import deepcopy
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
mod=1000000007
n=ii1()
arr=iia()
max=10**18
res,flag=1,0
if 0 in arr:
    print(0)
else:
    for i in range(n):
        res*=arr[i]
        if res>max:
            flag=1
            break
    if flag==1:
        print(-1)
    else:
        print(res)

Solution (Python):
N=int(input())

A=sorted([int(x) for x in input().split()],reverse=True)
if A[-1]==0:
  print(0)
else:
  m=1
  for a in A:
    m*=a
    if m>10**18:
      break
  print(m if m<=10**18 else -1)

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