#include <stdio.h>

int main(void){
    long long int n;
    scanf("%lld",&n);
    long long int a;
    scanf("%lld",&a);
    long long unsigned int ans = a;
    long long int ai[n-1];
    long long int i=0;
    if(ans == 0) {
        printf("0\n");
        return 0;
    }
    for(i = 0;i<n-1;i++){
        scanf("%lld",&ai[i]);
        if(ai[i] == 0) {
            printf("0\n");
            return 0;
        }
        if(ai[i] > 1000000000000000000){
            printf("-1\n");
            return 0;           
        }
    }

    for(i = 0;i<n-1;i++){
        
        if(ans> 500000000000000000 && ai[i] > 2){
            printf("-1\n");
            return 0;
        }

        ans *= ai[i];
        if(ans>1000000000000000000) {
            printf("-1\n");
            return 0;
        }
    }

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