stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef int ll;

typedef long long int li;

const ll MAXN=2e5+51,MOD=1e9+7;

ll cnt,num,ftot,res=1;

ll fact[MAXN],finv[MAXN],factor[MAXN],exponent[MAXN];

inline ll read()

{

    register ll num=0,neg=1;

    register char ch=getchar();

    while(!isdigit(ch)&&ch!='-')

    {

        ch=getchar();

    }

    if(ch=='-')

    {

        neg=-1;

        ch=getchar();

    }

    while(isdigit(ch))

    {

        num=(num<<3)+(num<<1)+(ch-'0');

        ch=getchar();

    }

    return num*neg;

}

inline ll qpow(ll base,ll exponent)

{

	ll res=1;

	while(exponent)

	{

		if(exponent&1)

		{

			res=(li)res*base%MOD;

		}

		base=(li)base*base%MOD,exponent>>=1;

	}

	return res;

}

inline void setup(ll cnt)

{

	fact[0]=fact[1]=finv[0]=1;

	for(register int i=2;i<=cnt;i++)

	{

		fact[i]=(li)fact[i-1]*i%MOD;

	}

	finv[cnt]=qpow(fact[cnt],MOD-2);

	for(register int i=cnt-1;i;i--)

	{

		finv[i]=(li)finv[i+1]*(i+1)%MOD;

	}

}

inline void getFact(ll num)

{

	for(register int i=2;i<=sqrt(num);i++)

	{

		if(num%i==0)

		{

			factor[++ftot]=i;

			while(num%i==0)

			{

				num/=i,exponent[ftot]++;

			}

		}

	}

	if(num!=1)

	{

		factor[++ftot]=num,exponent[ftot]=1;

	}

}

int main()

{

	cnt=read(),getFact(num=read()),setup(200000);

	for(register int i=1;i<=ftot;i++)

	{

		res=(li)res*fact[cnt+exponent[i]-1]%MOD;

		res=(li)res*finv[cnt-1]%MOD*finv[exponent[i]]%MOD;

	}

	printf("%d\n",res);

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define p 1000000007

ll fac[100055];

int num[105];

inline ll qpow(int x,int a)

{

	ll ans=1;

	while(a)

	{

		if(a&1) ans=1ll*ans*x%p;

		x=1ll*x*x%p;

		a>>=1;

	}

	return ans;

}

inline ll C(int n,int m)

{

	return fac[n]*qpow(fac[m],p-2)%p*qpow(fac[n-m],p-2)%p;

}

int main()

{

	int n,m,cnt;

	fac[0]=1;

	for(int i=1;i<=100050;++i)

		fac[i]=fac[i-1]*i%p;

	scanf("%d%d",&n,&m);

	int tmp=sqrt(m);

	for(int i=2;i<=tmp;++i)

	{

		if(m%i) continue;

		num[++cnt]=0;

		while(!(m%i))

			m/=i,++num[cnt];

	}

	if(m!=1) num[++cnt]=1;

	ll ans=1;

	for(int i=1;i<=cnt;++i)

		ans=ans*C(n+num[i]-1,num[i])%p;

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
// ===================================

//   author: M_sea

//   website: http://m-sea-blog.com/

// ===================================

#include <algorithm>

#include <iostream>

#include <cstdlib>

#include <cstring>

#include <cstdio>

#include <vector>

#include <cmath>

#define re register

using namespace std;



inline int read() {

    int X=0,w=1; char c=getchar();

    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }

    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();

    return X*w;

}



const int N=100000+10;

const int mod=1000000007;

inline int qpow(int a,int b) { int c=1;

    for (;b;b>>=1,a=1ll*a*a%mod) if (b&1) c=1ll*c*a%mod;

    return c;

}



int n,m;

int v[N],cnt=0;

int dp[32][N];



int fac[N],ifac[N];

inline void init(int n) {

    fac[0]=1;

    for (re int i=1;i<=n;++i) fac[i]=1ll*fac[i-1]*i%mod;

    ifac[n]=qpow(fac[n],mod-2);

    for (re int i=n;i;--i) ifac[i-1]=1ll*ifac[i]*i%mod;

}

inline int C(int n,int m) {

    if (n<m) return 0;

    return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;

}



int main() { init(1e5);

    n=read(),m=read();

    if (m==1) { puts("1"); return 0; }

    for (re int i=1;i*i<=m;++i) {

        if (m%i==0) {

            v[++cnt]=i;

            if (i*i!=m) v[++cnt]=m/i;

        }

    }

    sort(v+1,v+cnt+1); dp[0][1]=1;

    for (re int i=1;i<=min(n,31);++i)

        for (re int j=1;j<=cnt;++j)

            for (re int k=1;k<=j&&v[k]*2<=v[j];++k)

                if (v[j]%v[k]==0)

                    dp[i][j]=(dp[i][j]+dp[i-1][k])%mod;

    int ans=0;

    for (re int i=1;i<=min(n,31);++i)

        ans=(ans+1ll*C(n,i)*dp[i][cnt])%mod;

    printf("%d\n",ans);

    return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define p 1000000007

ll fac[100055];

int num[105];

inline ll qpow(int x,int a)

{

	ll ans=1;

	while(a)

	{

		if(a&1) ans=1ll*ans*x%p;

		x=1ll*x*x%p;

		a>>=1;

	}

	return ans;

}

inline ll C(int n,int m)

{

	return fac[n]*qpow(fac[m],p-2)%p*qpow(fac[n-m],p-2)%p;

}

int main()

{

	int n,m,cnt;

	fac[0]=1;

	for(int i=1;i<=100050;++i)

		fac[i]=fac[i-1]*i%p;

	scanf("%d%d",&n,&m);

	int tmp=sqrt(m);

	for(int i=2;i<=tmp;++i)

	{

		if(m%i) continue;

		num[++cnt]=0;

		while(!(m%i))

			m/=i,++num[cnt];

	}

	if(m!=1) num[++cnt]=1;

	ll ans=1;

	for(int i=1;i<=cnt;++i)

		ans=ans*C(n+num[i]-1,num[i])%p;

	printf("%lld\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):


#include <bits/stdc++.h>

using namespace std;

 

const int MAXN = 2e5+2;

unsigned long long nums[MAXN];

 

const long long MAXL = 1e18;

 

//判断a*b是否超过1e18

bool overflow(unsigned long long a, unsigned long long b) {

    //判断是否越界

    if (ULLONG_MAX / a < b) {

        return true;

    }

    //判断是否超过1e18

    unsigned long long ans = a*b;

    if (ans>MAXL) {

        return true;

    }

    return false;

}

 

int main() {

    int n;

    scanf("%d", &n);

    for (int i=0; i<n; i++) {

        scanf("%llu", &nums[i]);

        if (0==nums[i]) {

            printf("0\n");

            return 0;

        }

    }

 

    long long ans=1;

    for (int i=0; i<n; i++) {

        if (true == overflow(ans, nums[i])) {

            printf("-1\n");

            return 0;

        }

        ans *= nums[i];

    }// 

    printf("%llu", ans); 

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	long long tc;

	long long hasil = 1;

	int flag = 1;

	

	scanf("%lld", &tc);

	

	long long input[tc];

	

	for(int i = 0 ; i < tc; i++){

		scanf("%lld", &input[i]);

		if(input[i] == 0){

			printf("0\n");

			return 0;

		}

	}

	

	for(int i = 0; i < tc; i++){

		if(input[i] <= 1000000000000000000/hasil){

			hasil *= input[i];

		}else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld\n", hasil);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
 #include<bits/stdc++.h>

#include<iostream>

#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

#define ll  long long

#define ull unsigned long long

#define IO ios::sync_with_stdio(false), cin.tie(0)

#define endl '\n'

#define main() int main()

#define ff1(i,n) for(int i=1;i<=n;++i)

#define ff0(i,n) for(int i=0;i<n;++i)

#define pi acos(-1.0)

#define ms(a, x) memset(a, x, sizeof(a))

#define lowbit(x) ((x)&(-(x)))

#define pb push_back

#define binarycount __builtin_popcount(x)

#define tr t[root]

#define lson t[root << 1]

#define rson t[root << 1 | 1]

#define fir first

#define sec second

#define debug(x) cout<<x<<'\n'

#define sa(a) scanf("%d", &a)

#define sab(a, b) scanf("%d%d", &a, &b)

#define pa(a) printf("%d",a)

#define pab(a,b) printf("%d%d",a,b)

#define pii pair<int,int>

using namespace std;



#define maxn 200005

const int inf = 0x3f3f3f3f;

const int mod = 1e9+7;

const double eps = 1e-8;

ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}

ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}

ll powmod(ll a,ll b){

    ll ans = 1, pow = a%mod;

    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }

    return ans%mod;

}

ull a[maxn];

const ll maxx=1e18;

bool flow(ull a, ull b) {

    if (ULLONG_MAX/a<b) {

        return true;

    }

    ull ans = a*b;

    if (ans>maxx) {

        return true;

    }

    return false;

}

main() {

    int n;

    cin>>n;

    int f=1;

    for (int i=0;i<n;i++) {

        cin>>a[i];

        if (a[i]==0) f=0;

    }

    if(f==0){

    	cout<<0<<endl;

    	return 0;

	}

    ll ans=1;

    for (int i=0;i<n;i++) {

        if (flow(ans,a[i])) {

            cout<<"-1"<<endl;

            return 0;

        }

        ans*=a[i];

    }

    cout<<ans<<endl;





}

 

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	long long tc;

	long long hasil = 1;

	int flag = 1;

	

	scanf("%lld", &tc);

	

	long long input[tc];

	

	for(int i = 0 ; i < tc; i++){

		scanf("%lld", &input[i]);

		if(input[i] == 0){

			printf("0\n");

			return 0;

		}

	}

	

	for(int i = 0; i < tc; i++){

		if(input[i] <= 1000000000000000000/hasil){

			hasil *= input[i];

		}else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld\n", hasil);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
 #include<bits/stdc++.h>

#include<iostream>

#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

#define ll  long long

#define ull unsigned long long

#define IO ios::sync_with_stdio(false), cin.tie(0)

#define endl '\n'

#define main() int main()

#define ff1(i,n) for(int i=1;i<=n;++i)

#define ff0(i,n) for(int i=0;i<n;++i)

#define pi acos(-1.0)

#define ms(a, x) memset(a, x, sizeof(a))

#define lowbit(x) ((x)&(-(x)))

#define pb push_back

#define binarycount __builtin_popcount(x)

#define tr t[root]

#define lson t[root << 1]

#define rson t[root << 1 | 1]

#define fir first

#define sec second

#define debug(x) cout<<x<<'\n'

#define sa(a) scanf("%d", &a)

#define sab(a, b) scanf("%d%d", &a, &b)

#define pa(a) printf("%d",a)

#define pab(a,b) printf("%d%d",a,b)

#define pii pair<int,int>

using namespace std;



#define maxn 200005

const int inf = 0x3f3f3f3f;

const int mod = 1e9+7;

const double eps = 1e-8;

ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}

ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}

ll powmod(ll a,ll b){

    ll ans = 1, pow = a%mod;

    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }

    return ans%mod;

}

ull a[maxn];

const ll maxx=1e18;

bool flow(ull a, ull b) {

    if (maxx/a<b) {

        return true;

    }



    return false;

}

main() {

    int n;

    cin>>n;

    int f=1;

    for (int i=0;i<n;i++) {

        cin>>a[i];

        if (a[i]==0) f=0;

    }

    if(f==0){

    	cout<<0<<endl;

    	return 0;

	}

    ll ans=1;

    for (int i=0;i<n;i++) {

        if (flow(ans,a[i])) {

            cout<<"-1"<<endl;

            return 0;

        }

        ans*=a[i];

    }

    cout<<ans<<endl;





}

 

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	long long tc;

	long long hasil = 1;

	int flag = 1;

	

	scanf("%lld", &tc);

	

	long long input[tc];

	

	for(int i = 0 ; i < tc; i++){

		scanf("%lld", &input[i]);

		if(input[i] == 0){

			printf("0\n");

			return 0;

		}

	}

	

	for(int i = 0; i < tc; i++){

		if(input[i] <= 1000000000000000000/hasil){

			hasil *= input[i];

		}else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld\n", hasil);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



const int mxn = 1e5;

unsigned long long a[mxn + 11];

const long long mm = 1e18;



int main(){

	int n;

	scanf("%d", &n);

	unsigned long long ans = 1;

	for (int i = 0; i < n; i++){

		scanf("%lld", &a[i]);

	}

	sort(a, a + n);

	if (a[0] == 0LL){

		puts("0");

		return 0;

	}

	for (int i = 0; i < n; i++){

		if (a[i] <= mm / ans)

			ans *= a[i];

		else {

			puts("-1");

			return 0;

		}

	}

	printf("%lld\n", ans);

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	long long tc;

	long long hasil = 1;

	int flag = 1;

	

	scanf("%lld", &tc);

	

	long long input[tc];

	

	for(int i = 0 ; i < tc; i++){

		scanf("%lld", &input[i]);

		if(input[i] == 0){

			printf("0\n");

			return 0;

		}

	}

	

	for(int i = 0; i < tc; i++){

		if(input[i] <= 1000000000000000000/hasil){

			hasil *= input[i];

		}else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld\n", hasil);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>





#define endl '\n'

#define pi acos(-1)

#define euler_e 2.71828

#define pii pair<int,int>

#define pb push_back

#define all(a) a.begin(),a.end()

#define ll long long

#define ull unsigned long long

#define io freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

void mycode();

const ll int mod=998244353;

ll int ceil(ll int a,ll int b){return (a+b-1)/b;}

ll int min(ll int a, ll int b){if(a>b)return b;else return a;}

bool bit_check(ll int a,int i){

  if((a & (1LL<<i)))return 1;

  return 0;

}

ll int bit_toggle(ll int a,int i){

  return (a^(1LL<<i));

}

ll int bit_sum(ll int a,int i){

  return a+(1LL<<i);

}

ll int bit_sub(ll int a,int i){

  return a-(1LL<<i);

}

ll int mod_power(ll int x,ll int y){//x^y%p

  ll int p=mod;

  ll int res = 1;

  x = x % p;

  while (y > 0) { 

    if (y & 1)res = (res*x) % p;

    y = y>>1;x = (x*x) % p;

  }

  return res;

}

ll int power_of(ll int a,int b){

  if(a==0)return -1;

  return 1+power_of(a/b,b);

}

ll int power(ll int a, ll int b) {

	if(a==1)return 1;

    ll int res = 1;

    while (b > 0) {

        if (b & 1)

            res = res * a;

        a = a * a;

        b >>= 1;

    }

    return res;

}

//__int128

int main(){

	//boost;

	//io;

	//auto start = chrono::high_resolution_clock::now();

	mycode();

	//auto end = chrono::high_resolution_clock::now();cerr << "\nExecution time: "<< chrono::duration_cast<chrono::milliseconds>(end - start).count() << " ms" << endl;

	return 0;

}



void mycode(){

	int t;

	cin>>t;

	ull int arr[100005];

	bool flag1=0,flag2=0;

	for(int i=0;i<t;i++){cin>>arr[i];if(arr[i]==0)flag1=1;}

	if(flag1)cout<<0;

	else{

		__int128 k=1;

		for(int i=0;i<t;i++){

			k*=arr[i];

			//cout<<(ll)k<<endl;

			if(k>1000000000000000000){flag2=1;break;}

		}

		if(flag2)cout<<-1;

		else cout<<(ull)k<<endl;

	}

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	long long tc;

	long long hasil = 1;

	int flag = 1;

	

	scanf("%lld", &tc);

	

	long long input[tc];

	

	for(int i = 0 ; i < tc; i++){

		scanf("%lld", &input[i]);

		if(input[i] == 0){

			printf("0\n");

			return 0;

		}

	}

	

	for(int i = 0; i < tc; i++){

		if(input[i] <= 1000000000000000000/hasil){

			hasil *= input[i];

		}else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld\n", hasil);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long

using namespace std;

int main()

{

  ll n,i,j,sum,flg=0,cnt=0,c=1000000000000000000;

  cin>>n;

  ll ar[n+1];

  for(i=0;i<n;i++)

  {

      cin>>ar[i];

      if(ar[i]==0)

        cnt=1;

  }

  sum=ar[0];

  if(cnt==1)

    cout<<0<<endl;

  else

  {

      for(i=1;i<n;i++)

      {

          if(ar[i]<=c/sum)

            sum=sum*ar[i];

          else

          {

              flg=1;

              break;

          }

      }

      if(flg==1)

        cout<<-1<<endl;

      else

        cout<<sum<<endl;

  }



}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	long long tc;

	long long hasil = 1;

	int flag = 1;

	

	scanf("%lld", &tc);

	

	long long input[tc];

	

	for(int i = 0 ; i < tc; i++){

		scanf("%lld", &input[i]);

		if(input[i] == 0){

			printf("0\n");

			return 0;

		}

	}

	

	for(int i = 0; i < tc; i++){

		if(input[i] <= 1000000000000000000/hasil){

			hasil *= input[i];

		}else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld\n", hasil);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

const unsigned long long maxn=1e18;

const int maxx=1e5+10;

int main()

{

	unsigned long long a[maxx],ans=1;

	int n;

	cin>>n;

	int flag=0;

    for(int i=0;i<n;i++)

    {

    	cin>>a[i];

    	if(a[i]==0)

    	 flag=1;

    }

    if(flag)

    {

    	cout<<0<<endl;

    	return 0;

	}

    for(int i=0;i<n;++i)

    {

        if(a[i]<=maxn/ans) 

		 ans*=a[i];

        else

        {

            cout<<-1<<endl;

            return 0;

        }

    }

    cout<<ans<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	long long int test, result = 1;

	scanf("%lld", &test);

	long long x[test];

	

	for(int i = 0; i < test; i++) {

		scanf("%lld", &x[i]);

	}

	for(int i = 0; i < test; i++) {

		if(x[i] == 0) {

			printf("0");

			return 0;

		}

	}

	for(int i = 0; i < test; i++) {

		if(x[i] <= (1000000000000000000 / result)){

			result *= x[i];

		} else {

			result = -1;

			break;

		}

	}

	printf("%lld", result);

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#pragma region

#include <algorithm>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <stack>

#include <string>

#include <vector>

typedef long long ll;

#define rep(i, a, n) for (long long i = a; i <= n; i++)

#define IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

using namespace std;

#pragma endregion

int main() {

    IO;

    ll ans = 1;

    ll n;

    cin >> n;

    int flag = 0;

    while (n--) {

        ll x;

        cin >> x;

        if (!x) {

            cout << "0\n";

            return 0;

        }

        if (ll(1e18) / ans >= x)

            ans *= x;

        else

            flag = 1;

    }

    if (flag)

        cout << "-1\n";

    else

        cout << ans << endl;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	long long int test, result = 1;

	scanf("%lld", &test);

	long long x[test];

	

	for(int i = 0; i < test; i++) {

		scanf("%lld", &x[i]);

	}

	for(int i = 0; i < test; i++) {

		if(x[i] == 0) {

			printf("0");

			return 0;

		}

	}

	for(int i = 0; i < test; i++) {

		if(x[i] <= (1000000000000000000 / result)){

			result *= x[i];

		} else {

			result = -1;

			break;

		}

	}

	printf("%lld", result);

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

 

const int MAXN = 2e5+2;

unsigned long long nums[MAXN];

 

const long long MAXL = 1e18;

bool overflow(unsigned long long a, unsigned long long b) {

    if (ULLONG_MAX / a < b) {

        return true;

    }



    unsigned long long ans = a*b;

    if (ans>MAXL) {

        return true;

    }

    return false;

}

 

int main() {

    int n;

    scanf("%d",&n);

    for (int i=0;i<n;i++) {

        scanf("%llu", &nums[i]);

        if (0==nums[i]) {

            printf("0\n");

            return 0;

        }

    }

 

    long long ans=1;

    for (int i=0;i<n;i++) {

        if (true==overflow(ans,nums[i])) {

            printf("-1\n");

            return 0;

        }

        ans*=nums[i];

    }

 

    printf("%llu",ans);

 

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	long long int test, result = 1;

	scanf("%lld", &test);

	long long x[test];

	

	for(int i = 0; i < test; i++) {

		scanf("%lld", &x[i]);

	}

	for(int i = 0; i < test; i++) {

		if(x[i] == 0) {

			printf("0");

			return 0;

		}

	}

	for(int i = 0; i < test; i++) {

		if(x[i] <= (1000000000000000000 / result)){

			result *= x[i];

		} else {

			result = -1;

			break;

		}

	}

	printf("%lld", result);

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

long long x;

__int128 ans=1; 

long long a[100005];

void print(__int128 x)

{

	if (!x) return ;

	if (x < 0) putchar('-'),x = -x;

	print(x / 10);

	putchar(x % 10 + '0');

}

int main()

{

	int flag=1;

	int n;cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>a[i];

		if(a[i]==0)

		{

			flag=0;

		}

	}

	if(!flag)

	{

		cout<<"0";return 0;

	}

	else

	{

		int flag1=1;

		for(int i=1;i<=n;i++)

		{

			ans*=a[i];

			if(ans>1000000000000000000LL)

			{

				flag1=0;

			}

		}

		if(!flag1)

		{

			cout<<"-1";return 0;

		}

		else

		{

			print(ans);

		}

	}

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

  long long int t, sum = 1;

  scanf("%lld", &t);



  long long int n[t];

  for(int i = 0; i < t; i++) {

    scanf("%lld", &n[i]);

  }



  for(int i = 0; i < t; i++) {

    if(n[i] == 0) {

      printf("0");

      return 0;

    }

  }



  for(int i = 0; i < t; i++) {

    if(n[i] <= 1000000000000000000 / sum) {

      sum *= n[i];

    }

    else {

      printf("-1");

      return 0;

    }

  }

  printf("%lld", sum);

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <stdio.h>

#include <iostream>

#include <algorithm>

#include <vector>

#include <string>

#include <string.h>

using namespace std;

 

int main(){

   long long int result;

  int n;

 long long int a[100000]={};

n=0;

 

result=1;

    cin >> n;

 

 

 

    for(int i = 0; i < n; i++){

      	

        cin >> a[i];

      	if(1000000000000000000/result<a[i])result=-1;

      	if(result!=-1)result*=a[i];

      	if(result>1000000000000000000)result=-1;

      	if(a[i]==0){result=0;break;}

    }

	cout << result <<endl;

  return 0;

}


// Optimized solution to the same problem (faster):
#include <string>

#include <iostream>

#include <vector>

#include <string>

#include <utility>

#include <algorithm>

#include <math.h>

 

using namespace std;

int main() {

    cin.tie(0);

       ios::sync_with_stdio(false);

 

    int x;

    unsigned long long y = 1;

    int z = -1;

    unsigned long long p = 1000000000000000000;

    cin >> x;

    vector<unsigned long long> vec(x);

    for(int i=0; i<x;i++){

      cin >> vec.at(i);

    }

    for(int i=0; i<x;i++){

      if(vec.at(i)==0){

        cout << 0;

        return 0;

      }else if(vec.at(i)>p){

        cout << z;

        return 0;

      }

    }

    for(int i=0; i<x;i++){

     

      if(y>p/vec.at(i)){

        cout << z;

        return 0;

      }



y = y*vec.at(i);



    }

  

    

    if(y > p){

      cout << z;

    }else{

      cout << y;

    }

  

   return 0;

  

}


// Fastest known solution for this problem: