#include <stdio.h>

int main(void) {
	int n;
	scanf("%d", &n);

	int of = 0;

	long long int p = 1;
	while (n--) {
		long long int i;
		scanf("%lld", &i);

		if (i == 0) {
			puts("0");
			return 0;
		}

		if (of)
			continue;

		long long int pp = p*i;
		if (i != 0 && pp/i != p) {
			of  = 1;
		}
		p = pp;
	}

	if ((p != 0 && of) || p > 1000000000000000000) {
		puts("-1");
		return 0;
	}
	printf("%lld\n", p);
}
