#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }

long a[100000];
int main(void){
	int n=nextint();
	long ans=1;
	for(int i=0; i<n; i++){
		a[i]=nextlong();
		if(a[i]==0){
			ans=0;
		}
	}
	for(int i=0; i<n; i++){
		if(__builtin_smull_overflow(ans, a[i], &ans)){
			ans=-1;
			break;
		}else if(ans>1000000000000000000L){
			ans=-1;
			break;
		}
	}
	printf("%ld\n", ans);
}
