#include <stdbool.h>
#include <stdio.h>
typedef long long ll;
ll a[100001];
int main() {
	int n;
	bool is0 = false;
	ll ans = 1;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
		if (a[i] == 0) {
			is0 = true;
			printf("0\n");
			return 0;
		}
	}
	for (int i = 0; i < n; i++) {
		if ((1000000000000000000 + ans - 1 / ans) < a[i]) {
			ans = -1;
			break;
		}
		ans *= a[i];
		if (ans > 1000000000000000000) {
			ans = -1;
			break;
		}
	}
	printf("%lld\n", ans);
	return 0;
}
