/*
:.;.. . . . . .  .:,,..........:r..,.                                                 ..::r;r;r;r;r;r;;;;:;:;:;;:   . ... . .   ,:;:;:;:;:::;:;:;:;::,
                               .,,.:,                                            ,,:::::,:,:,:,:,,.,.,...........                ....................
      .   . .   ,zIZ999IL,,..           . . ...                        .rzJLzzIJJzzLcLLrr;r;r;;;;:;:::;:;::::,::::  . . . . ..,.,;;::::::::,:,:,:,::;.
         . .    jILcLr;;;LLLrr;;,,.                  .,.             zB$BkFFJJzcrLrrrr;;;;;;;;:;;;;;;r::,:::,:,,,:,  .   . ..,,;,;::::,:::,:,:,,::,::.
,     . . . .   SL;:;:;;;;;;;;r;rrL;r;;:,..     ..,;cJjL.         . .rr,,.::;rccJJzccrr;;;;;;:;:;:;:;;;,:,:,:,,,,,z.        .,:,,::,:,:,:,:::,:,:,:,:.
c;cr   .        FI:;;;;;;;:;:;;;:;;;;;rzczcL;rrLzjr;;r;rcjZZc:                   ,,rLzICFIzJzIJjFZIIL:,:::,:::,,,,c,   . . . ..,,;::,:::::,:,:,:,:,:,,
r,cc,           ;B;:;;;;;;rAC;;:;::::,;;:.. .;zrJObJeZZZeIJr:.:;L         .             :J6B#BH66S6eSeeL:::::,:::::,L.    . .      .;::,:::,:,:,:,:::::.
;,rc.            H6;:r;r;;:;;rrL;Lzjzcr;::,;;ZJerzjjzr,,;Jcr.            ..  ,:,          ,Jb9ZFccLIFZ;::;:;::::,,c.       .     :::,::::::::;:;::::,.
;.LL:   .        .$e::r;rLJzJzzcCKbSZJzzjS9crFF;zzJcLzCJ;..:Fbkc,             .:c;.          ,zIFzL;LIj;;;;:;:;::,JC            .:;,::;:;:;;;,:,,,,,,.
;,:Lc,            ,$C;::,ZJzzIC9ACAA69KzrIZkOd .JL6ILFLKz.,rzZJ;..redkc;.            ,Lc,          .;FjzrLLL;;;;;;:;::L#I           :r;;::,,,,.......,.,,.
;,rcz.             r$ZLcJzIIK69ZZZIJSeekS  cc:9ecK;:SF,:,.rJIr,.:J6jcJL            .LCJ           ;FC;..;;;;;;;;;:;:Sz         .:,...      ...,,,,,,,.
c;rL;.   .....      I#eZICZKCKjZeZCeCZKO   Z:r9S;ZC.r9c,;;.,:Lr:..,KbrLS;             JB:           ;Fc;,::::;;;;;:;,;.                . ..,,,,,,,,:,,
.     . .......     ,bIIZCZzKOeSZJCjZIG;  :J,LGk;zB:.ZZ:,LL,:,:,::,.F0J.jJ  .          ,$F            IHbIzrr::,::::r:          . ....,.,.,,,,:,,,,,,
   . . ... ...    .IZFIjCIzbDZkKzzZZJjK   Lz.JOS;.dC.rZ;;,cr::,::;;: r#9,LF, z,          Bk            :H#dd69KZFzLL;c,      ....,.,.,.,.,.,.........
. . . .......    LbZjIFCzck#zFKJLCCJJzJ.  c;,ZkcL ZB,.J;L;,rr,.:;::;r.;Gd;;z: ZJ          HH    .        I8KSKOHDB#88OBL .....,...,.,........ .....,:.
  .. . . ..    :ZKIFJIZzcKkLCKFLJFcJzLL,  zL.GL::,r$Z,,;,F, ;r:::;::;L:L6Or;cz.Ck:     .   $H   Lz        ;6Fz;,.,,rLLcc.....,.,.... . . ....,,,,:,,.
. ,.. ...     JKjzJIJFZLe;;K9zjcI;Lcc;c:  e;r9,,:,.k#c.,,zz .:Jr,:::::rLJS9c;rFzjkF     .   @S   #z        :SLL;:.              ....,...,,,,,,,.,..
. ,.   .     ZZJcJFFzbc;.LZGzcCrL:cL;:rr .k:Jj.:,:.ZeG,..Le  ;:Zr,:;:;,rcZK9c;;Z6zK6.   .,  :@;.,c@L    .   JbczzIJJc;,              ..,,,,,.,.,..
. .         eFcLIzJIec  bG9I;zC:::c::,;L .6,k,,,:,.cSJK..,O  ;,,eL,,::;,;zee6;r:zkJjd;   J;  H@.k:HG,   ,d   KSzJzJzJJFJJL;,.             ..,.,..
   . .     ZzLLZJJFz  ,Z#9Z.,Sj,,;;:,:;r ,CLJ.;,,,.;e,Jk, K; L,,,Zc,,,,;,;IbeZ;z.,ZCFOz  Fd, ;@jJ;Fd6    $H   8FczzJzJzzcJczzzLL::,.           ... .
. . ...   FzrLbJJz, .JcF$e..J8L.,:;,,;J; .6Z, z:,,.,Z.,rk:Jz :,,.,Zz;:,,;,;eO9cLF  ISC6c,8Z#  $BZrL6HI   9$S  cdrrL;r;LrLLLrLrLrLrLrL;;::..         .
     . . zz;r9Jc,  ;Se.99  FdS,,,::,.rj:  dc..cc.,,,z,,.,IbZ ,,,,..jJc:,:;;L90ZrJZ  rSjbZjJHj k$jFI9KG,  GS0L ,OBdSCFz;;:;;LrL;r;;;;;;:;;;;;::,:,,..
        ,J;rdj,  :;:ZZ;J .6HbF,,:,,,.;e., I.,.cZ. ;L;.,,,.IC :,.,,,.JJJ::;;rIBbrzIZ  ;KJZzzIB.LDZJFZKbZ  kCZd:Cr$BBBBHHSjL;:;;r;r;;;;:;:;::,:,,,:,:,:.
        crLZc  ;zL..KD: reJrkC.,,,,,.;Z,..L,..;e, .SFLLzL;zJ K;..,,..LJZrrL;cd9cLJZC  ZCIzcJZF:8ZJJZZZO  SIFZKZ:60H8G88BBB6Zc;:;;r;r;;:;:;:;,:,:,:,,,.
       LzLL,,;czF: .Kc.ZKc..GZ..,,,,.:e,..r:. LJJ..F9,:,,.c; LIJ: ..,.rJKrLLrSdLccJZ; CFFzczICIZSzJCeJd..ZFIICC,FH0H8d8OGOHH8CjL:,;rLr;;;:;:::;::.,,,.
     .;z;JJ,r;:cj,.L;c,OJr ,6z.:,.,. .C, ,,L. rJJ: :I..,,,c,.:.;cJ:..,.:ceccLekcrzzIj rjJJcJJjJjezzZFIS;LjFFJJz.L6ZGb9kO996dOH8BbJ;  ,;;;;;;:::::,.:r;
  ,,rrr,:k: ;,rLSzz;C# IZ  rcL.:: .. ,Kz  ::, ;;cJ. c,,,,.c.;.. .,rr:...,;Fzze6rrczzj:;IJcccJJccKzJCFCjJJcjJzJz rZ:JHkkKSS6b96dOBBBC;,::;;;;;:;:;:;Jr
:....::.cJ ,..zZdz. :0.c. cz:F,cc....ZJj:  ;L.,:,Jz .;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HF     .
   ., r;;   cBJ.Jde  :z  $@@@$jD$6jd@@b,.........,.,,,.,,,,:,..6$DGB9F:,.,zr;I....,Ob,.,:FZc;;FKZFJF;zjJ:::;:,,;.,S;..,r  zcI. KdOSSeeCeCZZ6G;     ..
. ..: z.r   ;K:c9;br  I 8@@L,  @@BG9SS@L:...........,.,,::;:;::.,,. ..,,:LcLJ.  .cGZ:.:;JFI;:.jLzzczz9C,:,r::,:L.,O,..,:. IFLz  FjSSSZZCZZGK.   ..,.,
. ..,,c,.;   ZZ6. CH. L8@@     @@B$$; OZ ..........,...:,         ,;,::rcrcz. .LS6c:,;;zFj;:,;eIJZJr6Z,:,Lr:,,:; LG,  .:.  Fcrr :rrJZbKK6Hc  ..,.,...
  . .;z;.c,  Fe. JKeO;cCD@L.   ,6,     Z......,...,.,.,,,         ;;::;::rr..;Cbz,;:;:r;;,,c;;9rcLr$K,:,;Z:,:.r: Jd.. ,..   F;r,,Lr;rIHHF.  ..... . .
     ;Lc,:c. ,. IeCSde.,Lrr. .   ,JZKbc;...,,,.,...,.,.,,,       :;:,,,;L;.,:Jz:.:,:,:,,,,,I.F,.c,G8,::,6z.:F.::.Kz   ,.    .J,;,rLJJc:.   .     . ..
.   ..LzL.,c, rjZC9Z: Lr;LKc. ,:,.;Fz:,.,.,,  .,,.,.,...,,:.    .:,,,.::,...Lr,,::;:;::::.JL,ZzZ,j#;,,,c@:,.Z;,,re,  .,      rc;Lzz;.       . .......
.  .r:,Lz,rL::.ZK9r..r::FjceS;.::;,,,:,:,,,,  .:,,........,:,. .,,.,.... .:LcL,;:;:;:;::.zO cB8r;GK,,:,BOc .Jk LJI  .: .  .. .r:..   . . ...........
  ,.. ..zbL ,LzIF.:r,.;CFJJcC6L.;:;,:,,,,,,rL.,,............,,,,,...,....;rrz,;;;;;::,,.zD:,OZZ.ZSe.,.z8cF. L8,cZ.  L. .  ,....   ...............
  ..:;;:;r,..zZ:,Ck, :ZCJJzJcJ9c ,,,,,.,.,.,,,...    . . . ........,....r;cF,::;:;::,..FGr ezrI.ZeI...kC:CL .JJL;  :,.   ,.,,,.,........ . .         .
..rr;::r;  ,:;:LOZ..,JJLzczLLJCdL ..,.,...,...  .:;;r;LrL;;:, ....,....r;zZ,::;:;::..,eb; jr.;Z,JrF  .9r..C: LJr..:.,   :,:,,...... .             .;JL
L::::::L  :;:zZSj..,;L;cccLccJzbB; ,.,...,.,...b#Scr;r;;;r;LJ,.,......;rzI;,:;::,, .LSZ; F.. Jjrr.L  ;Z:  ,crr..,..,,  :,,..     .            .,;JIz:
;,;::,L,,;;,zZJz, ,,;:LLLrJL:LZc;Z: ....,.,.. I@J.::;:;:;;;;J...,....rrLzL,::,:,. LbSJ,.Z: . J.,C ,. .L.  . ,:...  .: ...       . .          . cC;,.,.
,,:;::r;.,,,Jz;r ;.,,;LrrJr,;c::ccIr  ...,.,...JLr;;:;;;:;;c,.......:z:,cr,:::,..deFz,,IL ,. : .c; . ,,.   : .. ..                          :, .;,,:.
r,;:;::. ..:c:L.;r...:rrJr,,;:;zzLzZJ,   ...... .:;,,,,,,.,...,.,...c; ,J,,,:,.,kdrrrLzr  ; .....,    ..,  .;  .;.. . .     .   . .        :,z. ,..
r,:;:::, ..L;;r.I:..,;,,...;rzzc;rrJ9OFL,    . ... ............,.. ,L,;IC:,,..rKLZczFL;, ..             .:,.  ,;,.       .     . . .      .,;IL  .   ,
;,;;r;r,  ,L;;r:F. .:,. ,:L,:,;;L,cJz;LzeSF:,       ......,.,.... .LkJIrI:,,.;$CcSjrcL;  ,....,,,,;JJ r.  . .:;,;.            .          ,.;J,LL  .,Jc
r:rLrLLz. :JrzrLJ. ,;z,,.rc;: .;,LL;::,rCICIFFLr:,..   ....... ,;Ijjz;,.rL..,0e,.cKIj;:  Jc:,r;;rbD$$ODO;.  ....                        ,.:F;. 9: ,Ic,
r,r;;:;;:.:::,;::. .;:.    :kz.:. .:;:;J;:z;;;,,cLcr;;:,,,,.,rJjjcr,,.,.:J,.CB; ,.dC, ,:,L;;;;;LCKj;;;;;.     . ... . . . . .   .   .  ..,jr: ,J  JL;
              ,, . ,:        .:: . ,:;J, :Cc,,. ,,,. ;,::,rc::e;rL,..,,,.cL:zb:,;J;,.:FI;rrr;;JJ;:.....,,.       ....... . . . . .... ...Cr;. c; rcr,
. . . . . . . .,  ,:: . . .   ;;  .:;;,. .Z,:;r.,,,.  .:;,;::rHF;.,,,,,,,.Je;;rcj::.:CjrcLLLcZeLr.,.,,:...,..        .... . . . . .   , jL;,.,Z  c;,.
. ................ :,......,.  .;,.:r.  .,L .z:.,rr;,LcCz;,;FzJG.,,:,:,:,:,Jc;jJ::::ZerLLcLcFOLc....,,.....,,,..       ,,,.,.,...... , zzr;, zz ,c,. .
,                                .;.,     .     .,:....   zZL;Lb. ..........Lc,.,,.cZ:::;:;rC,,   ...,.                             . :L,.: .J  ,...,.
*/

 // #include <iostream>
#include <bits/stdc++.h>
/*#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>*/
#define ll long long
#define dl double
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define unique(a)       sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Assert(x)       {if(!(x)){cerr<<"Assertion failed at line "<<__LINE__<<": "<<#x<<" = "<<(x)<<"\n";exit(1);}}
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define mod 1000000007

using namespace std;

typedef long long LL;
   bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}
// A utility function to get the middle index from corner indexes.


/*  A recursive function to get the xor of values in given range
    of the array. The following are parameters for this function.

    st    --> Pointer to segment tree
    si    --> Index of current node in the segment tree. Initially
              0 is passed as root is always at index 0
    ss & se  --> Starting and ending indexes of the segment
                 represented by current node, i.e., st[si]
    qs & qe  --> Starting and ending indexes of query range */


/* A recursive function to update the nodes which have the given
   index in their range. The following are parameters
    st, si, ss and se are same as getXorUtil()
    i    --> index of the element to be updated. This index is
             in input array.
   diff --> Value to be added to all nodes which have i in range */

//     bool prime[1000010];
// void SieveOfEratosthenes(int n)
// {
//     // Create a boolean array "prime[0..n]" and initialize
//     // all entries it as true. A value in prime[i] will
//     // finally be false if i is Not a prime, else true.

//     memset(prime, true, sizeof(prime));

//     for (int p=2; p*p<=n; p++)
//     {
//         // If prime[p] is not changed, then it is a prime
//         if (prime[p] == true)
//         {
//             // Update all multiples of p greater than or
//             // equal to the square of it
//             // numbers which are multiple of p and are
//             // less than p^2 are already been marked.
//             for (int i=p*p; i<=n; i += p)
//                 prime[i] = false;
//         }
//     }

//     // Print all prime numbers
//     // for (int p=2; p<=n; p++)
//        // if (prime[p])
//        //    cout << p << " ";
// }

// The function to update a value in input array and segment tree.
// It uses updateValueUtil() to update the value in segment tree

const long long MAX_SIZE = 1000001;

// isPrime[] : isPrime[i] is true if number is prime
// prime[] : stores all prime number less than N
// SPF[] that store smallest prime factor of number
// [for Exp : smallest prime factor of '8' and '16'
// is '2' so we put SPF[8] = 2 , SPF[16] = 2 ]
vector<long long >isprime(MAX_SIZE , true);
vector<long long >prime;
vector<long long >SPF(MAX_SIZE);

// function generate all prime number less then N in O(n)
void manipulated_seive(int N)
{
    // 0 and 1 are not prime
    isprime[0] = isprime[1] = false ;

    // Fill rest of the entries
    for (long long int i=2; i<N ; i++)
    {
        // If isPrime[i] == True then i is
        // prime number
        if (isprime[i])
        {
            // put i into prime[] vector
            prime.push_back(i);

            // A prime number is its own smallest
            // prime factor
            SPF[i] = i;
        }

        // Remove all multiples of  i*prime[j] which are
        // not prime by making isPrime[i*prime[j]] = false
        // and put smallest prime factor of i*Prime[j] as prime[j]
        // [ for exp :let  i = 5 , j = 0 , prime[j] = 2 [ i*prime[j] = 10 ]
        // so smallest prime factor of '10' is '2' that is prime[j] ]
        // this loop run only one time for number which are not prime
        for (long long int j=0;
             j < (int)prime.size() &&
             i*prime[j] < N && prime[j] <= SPF[i];
             j++)
        {
            isprime[i*prime[j]]=false;

            // put smallest prime factor of i*prime[j]
            SPF[i*prime[j]] = prime[j] ;
        }
    }
}

ll power(ll x,ll y,ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res%p;
}

int main()
{
    ll i,a,j,n,m,b,t,k;

    //cin>>t;

    //while(t--)
    //{
        cin>>n;
        a = 1;
        b = 1;
        
        ll z = 0;
        for(i=0;i<n;i++)
        {
            cin>>k;

            if(k == 0)
                z++;
            
            if(a < 1000000000)
                a = a*k;
            else if(b < 1000000000)
            {
                b = b*k;
            }
        }

        if(z > 0)
        {
            cout<<0;
        }
        else if(a > 1000000000 && b > 1000000000)
            cout<<-1;
        else if(a*b > 1000000000000000000)
        {
            cout<<-1;
        }
        else
            cout<<a*b;
    //}
    return 0;
}




Measured memory_bytes: 18688