#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h>/*限界*/

//---------------------------------------------------
//a


#define rep(i, n) for(int  i = 0; i < (n); i++)
#define max(a,b) ((a>b)?a:b)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)

int main(void)
{
  LL n;
  LL a;
  int flag = 0;
  LL sum = 0;
  LL sumback = 0;
  scanf("%lld", &n );
  for (LL i = 0; i < n; i++) {
    scanf("%lld", &a);

    if (a == 0) {
      printf("0\n");
      return 0;
    }

    if (i != 0) {
      sumback = sum;
      sum *= a;
    }else{
      sum = a;
      sumback = sum;
    }

    if (sum > 1000000000000000000 || sum < 0) {
      flag = 1;
    }
    if (sum < sumback) {
      flag = 1;
    }
  }
  if (flag == 0) {
    printf("%lld\n",sum );
  }else{
    printf("-1\n");
  }
  return 0;
}
