#include <cstdio>
using namespace std;

int main() 
{
	int n;
	scanf("%d", &n);
	long long res = 1, v;
	bool f = true;
	while (n--) {
		scanf("%lld", &v);
		if (!v) {
			f = true;
			res = 0;
		}
		else if (res >= ((long long)1e18) / v + 1) f = false;
		res *= v;
	}
	if (f) printf("%lld\n", res);
	else printf("-1\n");
	return 0;
}
