#include<stdio.h>
int main(void){
    int N, check = 0, recheck = 0;
    long int big = 1000000000000000000, a = 1, mae = 1;
    scanf("%d", &N);
    long int A[N];
    for(int i = 0; i < N; i++){
        scanf("%ld", &A[i]);
        if(A[i] == 0){
            check += 0;
            break;
        }
        a *= A[i];
        if(a > big){
            recheck += 1;
        }
        else if(a < mae) recheck += 1;
        mae = a;
    }
    
    if(check > 0) printf("0\n");
    else {
        if(recheck == 0){
            printf("%ld", a);
        }
        else printf("-1\n");
    }
    
    return 0;

}