#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
	int n;
	cin >> n;
	unsigned long long ans = 1;
	int f = 0;
	rep(i, n){
		unsigned long long in;
		cin >> in;
		unsigned long long ans0 = ans;
		unsigned long long in0 = in;
		int ansk = 0;
		int ink = 0;
		ans *= in;
		while(ans0 >= 10){
			ans0 /= 10;
			ansk++;
		}
		while(in0 >= 10){
			in0 /= 10;
			ink++;
		}
		if(ink + ansk > 18){
			f = 1;
			ans = 1;
		}
		if(ink + ansk == 18 && ans0 * in0 > 1){
			f = 1;
			ans = 1;
		}
		//cout << ink << ' '  << ansk << endl;
		
		if(ans > 1000000000000000000){
			f = 1;
			ans = 1;
		}
	}
	if(ans == 0){
		cout << 0 << endl;
	}else if(f == 1){
		cout << -1 << endl;
	}else{
		cout << ans << endl;
	}
	return 0;
}