#include<stdio.h>
int f(long long n){
    int p = 1;
    while(n > 9){
        n /= 10;
        p++;
    }
    return p;
}
int s(long long n){
    while(n > 9){
        n /= 10;
    }
    return n;
}
int main(){
    int n;
    scanf("%d",&n);
    int keta;
    long long a[n];
    long long ans = 1;
    for(int i = 0; i < n; i++){
        scanf("%lld",&a[i]);
        if(a[i] == 0)
            ans = 0;
    }
    keta = f(a[0]);
    if(ans == 0){
        puts("0");
        return 0;
    }
    ans = a[0];
    int i = 1;
    while(keta < 18 && i < n){
        int p = f(a[i]);
        int q = s(ans);
        int r = s(a[i]);
        int l = keta + p + f(q * r);
        if(l >= 18)
            keta = 18;
        ans *= a[i];
        keta = f(ans);
        i++;
    }
    if(ans == 1e18)
        printf("%lld\n",ans);
    else if(keta >= 18)
        puts("-1");
    else    printf("%lld\n",ans);
    return 0;
}