#include <stdio.h>
#include <inttypes.h>

#define INF UINT64_C(1111111111111111111)
#define LIMIT UINT64_C(1000000000000000000)

uint64_t add(uint64_t a, uint64_t b) {
	uint64_t x = a + b;
	return x > INF ? INF : x;
}

uint64_t mul(uint64_t a, uint64_t b) {
	uint64_t r = 0;
	while (b > 0) {
		if (b & 1) r = add(r, a);
		a = add(a, a);
		b >>= 1;
	}
	return r;
}

int main(void) {
	int N, i;
	uint64_t answer = 1;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		uint64_t A;
		if (scanf("%" SCNu64, &A) != 1) return 1;
		answer = mul(answer, A);
	}
	if (answer > LIMIT) puts("-1"); else printf("%" PRIu64 "\n", answer);
	return 0;
}
