#include <stdio.h>

int main(void)
{
	int N,i,d=0;
	long long total=1,a;
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%lld",&a);
		if(d==0){
			total*=a;
			if(total>1000000000000000000)d++;
		}
		if(a==0){total=0;d=0;}
	}
	if(d!=0)printf("-1");
	else printf("%lld",total);
	return 0;
}