#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

bool is_product_overflow(ll a, ll b) {
  ll prod = a * b;
  // printf("%lld %lld %lld: %lld\n", prod, a, b, prod/b);
  return (prod / b != a);
}
 
int main() {
    ll N;
    cin  >> N;
    vl A(N);
    ll sum = 1;
    int flag = 0;
 
    for(ll i=0; i<N; i++){
        cin >> A.at(i);
        if(A.at(i) == 0){
            flag = 1;
        }
    }
 
    if(flag == 1){
        cout << 0 << endl;
        return 0;
    }
 
    for(ll i=0; i<N; i++){
        if(is_product_overflow(sum, A.at(i))){
            cout << -1 << endl;
            return 0;
        }
        sum = sum * A.at(i);
        // cout << sum << endl;
        if(sum > 1000000000000000000){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << sum << endl;
}