#include<stdio.h>
#include <math.h>

int main(void){
  int N;
  scanf("%d", &N);
  long long int ans=1, check=1, A[N];
  for(int i=0; i<N; i++){
    scanf("%lld", &A[i]);
    if(A[i] == 0){
      ans = 0;
      check = 0;
    }
  }
  for(int i=0; i<N; i++){
    ans *= A[i];
    if(ans / A[i] != check || (long)pow(10,18) < ans){
      ans = -1;
      break;
    }
    check *= A[i];
  }
  printf("%lld\n", ans);
}
