#include<stdio.h>
#include<stdlib.h>
typedef long long ll;
#define max 1000000000000000000
int main(void)
{
  ll n,ans=1,ans_old;
  scanf("%lld",&n);
  for(int i=0;i<n;i++){
    ll tmp;
    scanf("%lld",&tmp);
    ans_old=ans;
    ans*=tmp;
    if(ans>=max){
      printf("-1");
      return 0;
    }
    if((ans_old/ans)!=tmp){
      printf("-1");
      return 0;
    }
  }
  
  printf("%lld",ans);
  return 0;
}