#include<stdio.h>

int main(){
  long long n,ans=1;
  scanf("%lld",&n);
  long long a[n+1],b=1000000000000000000;
  for(long long i=1;i<=n;i++){scanf("%lld",&a[i]);}
  
  for(long long i=1;i<=n;i++){
    if((b-b%ans)/ans<a[i]){printf("-1");return 0;}
    
    ans*=a[i];
  }
  
  printf("%lld",ans);
}
