///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define Br cout<<endl
#define pb push_back
#define mp make_pair
#define fe first
#define se second
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (x) << endl
#define PTT(x) cout << (#x) << " is " << (x) << endl
#define SPD_emergency ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
int M = 1e18 + 1;
const int N = 1e6 + 10;
const int IM = 1e15 + 37;
const int PI = 3.14159265;
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " "; cout << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] << ' ' ; cout << endl;}
void IN(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}
inline void PP(int n) { cout << n << " ";}
inline void PP(int n, int m) { cout << n << " " << m << endl;}
inline void PP(int n, int m, int q) {  cout << n << " " << m << " " << q << endl;}
inline void PP(int n, int m, int q, int u) {  cout << n << " " << m << " " << q << " " << u << endl;}
inline void op() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
// <-------------------------------------------------------------------------------------------------------------------------------------------------------------------------> Ignore This--> setprecision memset substr pop_back  insert tuple first second push_back string continue make_pair break deque stack queue sort reverse accumulate  count lower_bound upper_bound next_permutation copy_n __builtin_popcount make_tuple
// <========================================================================================================================================================================
string multiply(string num1, string num2)
{
    int len1 = num1.size();
    int len2 = num2.size();
    if (len1 == 0 || len2 == 0)
        return "0";

    // will keep the result number in vector
    // in reverse order
    vector<int> result(len1 + len2, 0);

    // Below two indexes are used to find positions
    // in result.
    int i_n1 = 0;
    int i_n2 = 0;

    // Go from right to left in num1
    for (int i = len1 - 1; i >= 0; i--)
    {
        int carry = 0;
        int n1 = num1[i] - '0';

        // To shift position to left after every
        // multiplication of a digit in num2
        i_n2 = 0;

        // Go from right to left in num2
        for (int j = len2 - 1; j >= 0; j--)
        {
            // Take current digit of second number
            int n2 = num2[j] - '0';

            // Multiply with current digit of first number
            // and add result to previously stored result
            // at current position.
            int sum = n1 * n2 + result[i_n1 + i_n2] + carry;

            // Carry for next iteration
            carry = sum / 10;

            // Store result
            result[i_n1 + i_n2] = sum % 10;

            i_n2++;
        }

        // store carry in next cell
        if (carry > 0)
            result[i_n1 + i_n2] += carry;

        // To shift position to left after every
        // multiplication of a digit in num1.
        i_n1++;
    }

    // ignore '0's from the right
    int i = result.size() - 1;
    while (i >= 0 && result[i] == 0)
        i--;

    // If all were '0's - means either both or
    // one of num1 or num2 were '0'
    if (i == -1)
        return "0";

    // generate the result string
    string s = "";

    while (i >= 0)
        s += std::to_string(result[i--]);

    return s;
}
int a, b;
signed  main() {
    SPD_emergency
   
    int i, j, x, y, u, l;
    // int t; cin >> t; while (t--)
    {   i = j = x = y = u = l = 0;

        int n;
        cin >> n;
        int a[n + 10];
        for ( i = 0; i < n; i++) {
            cin >> a[i];
            if (a[i] == 0)
                y++;
        }
        if (y) {
            PT(0);
            return 0;
        }
        string ans = "1";
        for (i = 0; i < n; i++) {
            x = a[i];
            string b = to_string(x);
            ans = multiply(ans,b); //PT(ans);
            if(ans.size()>19){ //PT(ans);
                PT(-1);
                return 0;
            }
            bool ck = 0;
            if(ans.size()==19){
                for(j=1;j<ans.size();j++){
                    if(ans[j]!='0'){ //PT(ans);
                        PT(-1);
                        return 0;
                    }
                }
            }
        }
        PT(ans);





        /**/

    }


    return 0;
}

Measured memory_bytes: 4492