#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
typedef long long ll;

int main(void)
{
    ll n, a[100001];
    ll ans = 1;
    int flag = 1;
    scanf("%lld", &n);
    rep(i, n)
    {
        ll pre = ans;
        scanf("%lld", &a[i]);
        ans *= a[i];
        if (a[i] != 0)
            if (pre < LLONG_MAX / a[i])
                ;
            else
                flag = 0;
        else if (pre != 0)
            if (a[i] < LLONG_MAX / pre)
                ;
            else
                flag = 0;
    }

    if (ans == 0)
    {
        puts("0");
        return 0;
    }

    if (ans > 1000000000000000000 || flag == 0)
        ans = -1;

    printf("%lld\n", ans);
    return 0;
}