#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=1;
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
		if(a[i]==0)
			sum=0;
	}
	if(!sum)goto rr;
	sum=(a[0]);
	for(i=1;i<n;i++){
		d=mod/sum;
		if(mod%sum)d++;
		if(d<a[i]){
			sum=-1;break;
		}
		sum*=a[i];
		if(sum>mod){sum=-1;
		break;}
	}rr:
	printf("%lld\n",sum);
}