#include<stdio.h>
int main(){
  long long n,d[100010],i,m=1e18;
  scanf("%lld",&n);
  for(i=0;i<n;i++)scanf("%lld",&d[i]);
  for(i=0;i<n;i++){
    if(d[i]==0){
      printf("0\n");
      return 0;
    }
  }
  for(i=0;i<n;i++){
    if(m<d[i])goto END;
    m=(m-1)/d[i]+1;
  }
  m=1;
  for(i=0;i<n;i++)m*=d[i];
  if(m>(long long)1e18)goto END;
  printf("%lld\n",m);
  return 0;
 END:;
  printf("-1\n");
  return 0;
}
