#include <stdio.h>
#include <math.h>
#define mod 1000000000000000000
int main(int argc, char *argv[])
{
	long long n,i;
	scanf("%lld",&n);
	signed long long a[n],d,sum;
	for(i=0;i<n;i++)
		scanf("%lld",&a[i]);
	sum=(a[0]);
	for(i=1;i<n;i++){
		d=sum;
		sum*=a[i];
		if(sum>mod||d>sum||a[i]>sum){
			sum=-1;
			break;
		}
		
	}
	printf("%lld\n",sum);
}