#include <bits/stdc++.h>
using namespace std;
//4/
 
typedef unsigned long long ull;
typedef long long ll;
#define cin_exp cin.exceptions(cin.failbit);
#define dis_inbf cin.ignore(numeric_limits<streamsize>::max(),'\n'); //discards the imput buffer
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define repG(i, n)    for(ll i = 0; i < (n); ++i)
#define rep(i, a, n)  for(ll i = a; i < (n); ++i)
#define repd(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fill_2(a,b)  memset(a, 0, sizeof (a));memset(b, 0, sizeof (b));
#define fill_n(a) memset(a,-1,sizeof(a))
#define fst first
#define snd second
#define mpr make_pair
#define pb push_back
#define mod 1000000000000000000//1000000009
#define PI  3.14159265358979323846264
#define fftmod 998244353
#define arr_106 1000011
#define arr_105 100011
#define ll_inf 1223372036854775807
#define int_inf 1147483647
#define endl "\n"
#define sort_vec(v) sort(v.begin(),v.end())
#define sort_vecr(v) sort(v.rbegin(),v.rend())
#define all_of(v) v.begin(),v.end()
#define l_b lower_bound
#define u_b upper_bound
#define trace_1(a) for(auto i:a) cout<<i<<" ";cout<<endl;
#define trace_2(a,b) for(auto i:a)cout<<i<<" ";cout<<endl;for(auto i:b)cout<<i<<" ";cout<<endl;
//#define int long long
 
typedef long double ld;
typedef pair<ll, ll> pii;
typedef pair<ll, pii> pip;
typedef pair<pii, ll> ppi;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef map<ll,ll> mii;
ll fac[1000006];
 
 
inline ll exp(ll x,ll n){ll r=1;x=x%mod;while(n){if(n%2)r=(r*x)%mod;x=(x*x)%mod;n=n/2;}return r;}
inline ll mmi(ll a){return exp(a,mod-2)%mod;}
inline ll fact(ll n){ll res=1;rep(i,1,n+1){res=(res*i)%mod;}return res;}
inline void fact_a(){fac[0]=1;fac[1]=1;rep(i,1,105){fac[i]=(fac[i-1]*i)%mod;}}
inline ll inv_fact(ll n){/*fact_a();*/ll par=fac[n];ll res=mmi(par);return res;}
inline ll comb(ll n,ll r){/*fact_a();*/if(n==r && r==0)return 1;if(n<r)return 0;return ((fac[n]*inv_fact(r))%mod*inv_fact(n-r))%mod;}
 
struct triplet{ll a,b,c;};
bool operator < (const triplet &t1,const triplet &t2){
	if(t1.a<t2.a)return true;
	if(t1.a==t2.a && t1.b <t2.b)return true;
	if(t1.a==t2.a && t1.b ==t2.b && t1.c<t2.c)
		return true;return false;}
 
pair<ll,pii > ex_gcd(ll a,ll b)
{   if(b==0){return mpr(a,mpr(1,0));}
    pip p=ex_gcd(b,a%b);
	ll gcd=p.fst;ll x1=p.snd.fst;ll y1=p.snd.snd;
    ll x=y1;ll y=x1-(a/b)*y1;
	return mpr(gcd,mpr(x,y));
} 
ll prime[1000006];
ll spf_prime[1000006];
void sieve(){for(ll i=2;i*i<=1000000;i++)if(prime[i]==0)for(ll j=i*i;j<=1000000;j+=i)prime[j]=1;}
void spf(){
	 for(ll i=2;i*i<=1000000;i++)if(!spf_prime[i])for(ll j=i*i;j<=1000000;j+=i)if(!spf_prime[j])spf_prime[j]=i;
		for(ll i=2;i<=1000000;i++)if(!spf_prime[i])spf_prime[i]=i;
}
 
ll getparent_BIT(ll idx)
{
    return idx-(idx& -idx);
}
ll getnext_BIT(ll idx)
{
    return idx+(idx& -idx);
}
ll getsum_BIT(ll idx,ll BIT[],ll n)
{   
	//idx++;
	ll sum=0;
	while(idx>0)
	{
      sum+=BIT[idx];
      idx=getparent_BIT(idx);
      
	}
	return sum;
}
void update_BIT(ll idx,ll BIT[],ll val,ll n)
{
	//idx++;
	while(idx<=n)
	{
		BIT[idx]+=val;
		idx=getnext_BIT(idx);
	}
}
void build_BIT(ll BIT[],ll a[],ll n)
{
	rep(i,0,n)
	{
		update_BIT(i,BIT,a[i],n);
	}
}
 
void comp_lps(string s,ll lps[],ll n)
{  ll i=1,j=0;
	while(i<n){if(s[i]==s[j]){lps[i++]=++j;}
		else{ if(j!=0) j=lps[j-1]; else lps[i++]=0;}}
}
 
 
void dfs_l(ll u,vvi &adj,ll status[])
{
	if(status[u]==1) return;status[u]=1;
	rep(i,0,adj[u].size())
	  dfs_l(adj[u][i],adj,status);
}
 
// ifstream fin("input.txt");ofstream fout("output.txt");
/*
#ifndef ONLINE_JUDGE
	double _tBeg=clock();
#endif
*/

int main()
{
	IOS;
	ll n;
	cin>>n;
	ll a[n];
	rep(i,0,n) cin>>a[i];
	rep(i,0,n)
	{
		if(a[i]==0)
		{
			cout<<0<<endl;
			return 0;
		}
	}
	ll p=1;
	ll cc=0;
	rep(i,0,n)
	{
      ll g=(1000000000000000000)/p;
      if(a[i]>g)
      {
      	cc=1;
      	break;
      }
      else
      {
      	p=(p*a[i]);
      }
	}
	if(cc==0)
		cout<<p<<endl;
	else
		cout<<-1<<endl;
}


Measured memory_bytes: 4388