#include<stdio.h>
int main (void){
  int n,i;
  long long j,k,a[100000],ans,aaa=1000000000000000000;
  ans=1;
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%lld",&a[i]);
    if(a[i]==0){ans=0;}
  }

  if(ans!=0){
    for(i=0;i<n;i++){
      k=aaa%ans;
      j=(aaa-k)/ans;
      
      if(j<a[i]){ans=-1;break;}
    
      ans=ans*a[i];
    }
  }
  printf("%lld",ans);
  return 0;
}