#include<stdio.h>
#include<math.h>
#include<string.h>
 
int keta(long long int xx)
{
	int yy = 0;
	while (1) {
		xx = xx / 10;
		yy++;
		if (xx < 10) {
			break;
		}
	}
	return yy;
}
 
int ke(long long int xx, long long int yy) {
	int xxx = 0;
	while (1) {
		xx = xx / 10;
		xxx++;
		if (xx < 10) {
			break;
		}
	}
	int yyy = 0;
	while (1) {
		yy = yy / 10;
		yyy++;
		if (yy < 10) {
			break;
		}
	}
	if (xx*yy > 50) {
		return 1;
	}
	return 0;
}
 
 
int main() {
	int i, j, k;
	int  n;
	long long int f = 1, m = 0;
	int g = 0;
	int x[110] = {0};
	int a, b, c, d;
 
 
	scanf("%d", &n);
 
	for (i = 0;i < n;i++) {
		scanf("%lld", &m);
 
		if (keta(f) + keta(m)+ke(f,m) > 18) {
			f = -1;
			break;
		}
 
		f = f * m;
 
		if (f > 1000000000000000000) {
			f = -1;
			break;
		}
	}
 
	printf("%lld", f);
 
	return 0;
}