stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
 #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;





}

 

// Faster C++ solution for the same problem (measured speedup: 5.236588266356007x):
#include<stdio.h>

int main (){



	long long int berapaKali;	

	scanf("%lld", &berapaKali);

	long long int a1[berapaKali];

	long long int a2 = 1;

	long long int max = 1000000000000000000;

	long long int hasil ;

	

	for(int j=0;j<berapaKali;j++){

		scanf("%lld", &a1[j]);

	}

	

	for(int h=0;h<berapaKali;h++){

	

		if(a1[h]==0){

			printf("0\n");

			return 0;

		}

	}

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

		if(a1[i]<=max/a2){	

		a2*= a1[i];	

		}else{

		printf("-1\n");

		return 0;

		}

	}

	

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



	return 0;

}
// Slower C++ solution:
 #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;





}

 

// Faster C++ solution for the same problem (measured speedup: 5.236613425742688x):
#include<stdio.h>

int main (){



	long long int berapaKali;	

	scanf("%lld", &berapaKali);

	long long int a1[berapaKali];

	long long int a2 = 1;

	long long int max = 1000000000000000000;

	long long int hasil ;

	

	for(int j=0;j<berapaKali;j++){

		scanf("%lld", &a1[j]);

	}

	

	for(int h=0;h<berapaKali;h++){

	

		if(a1[h]==0){

			printf("0\n");

			return 0;

		}

	}

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

		if(a1[i]<=max/a2){	

		a2*= a1[i];	

		}else{

		printf("-1\n");

		return 0;

		}

	}

	

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



	return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.166889488552935x):
#include<stdio.h>

int main (){



	long long int berapaKali;	

	scanf("%lld", &berapaKali);

	long long int a1[berapaKali];

	long long int a2 = 1;

	long long int max = 1000000000000000000;

	long long int hasil ;

	

	for(int j=0;j<berapaKali;j++){

		scanf("%lld", &a1[j]);

	}

	

	for(int h=0;h<berapaKali;h++){

	

		if(a1[h]==0){

			printf("0\n");

			return 0;

		}

	}

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

		if(a1[i]<=max/a2){	

		a2*= a1[i];	

		}else{

		printf("-1\n");

		return 0;

		}

	}

	

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



	return 0;

}
// Slower C++ solution:
#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;

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.3166447885828365x):
#include<stdio.h>

int main (){



	long long int berapaKali;	

	scanf("%lld", &berapaKali);

	long long int a1[berapaKali];

	long long int a2 = 1;

	long long int max = 1000000000000000000;

	long long int hasil ;

	

	for(int j=0;j<berapaKali;j++){

		scanf("%lld", &a1[j]);

	}

	

	for(int h=0;h<berapaKali;h++){

	

		if(a1[h]==0){

			printf("0\n");

			return 0;

		}

	}

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

		if(a1[i]<=max/a2){	

		a2*= a1[i];	

		}else{

		printf("-1\n");

		return 0;

		}

	}

	

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



	return 0;

}
// Slower C++ solution:
#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;

  }



}


// Faster C++ solution for the same problem (measured speedup: 5.229080233368412x):
#include<stdio.h>

int main (){



	long long int berapaKali;	

	scanf("%lld", &berapaKali);

	long long int a1[berapaKali];

	long long int a2 = 1;

	long long int max = 1000000000000000000;

	long long int hasil ;

	

	for(int j=0;j<berapaKali;j++){

		scanf("%lld", &a1[j]);

	}

	

	for(int h=0;h<berapaKali;h++){

	

		if(a1[h]==0){

			printf("0\n");

			return 0;

		}

	}

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

		if(a1[i]<=max/a2){	

		a2*= a1[i];	

		}else{

		printf("-1\n");

		return 0;

		}

	}

	

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



	return 0;

}
// Slower C++ solution:


#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.169779929276324x):
#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);

}
// Slower C++ solution:
 #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;





}

 

// Faster C++ solution for the same problem (measured speedup: 5.239280028377398x):
#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);

}
// Slower C++ solution:
 #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;





}

 

// Faster C++ solution for the same problem (measured speedup: 5.2393052006967515x):
#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);

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.169545423330807x):
#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);

}
// Slower C++ solution:
#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;

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.319377702036253x):
#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);

}
// Slower C++ solution:
#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;

  }



}


// Faster C++ solution for the same problem (measured speedup: 5.231768136037679x):
#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);

}
// Slower C++ solution:


#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.161101393810641x):
#include <stdio.h>



int main() {

  int x;

  scanf("%d", &x);

  long long int a[x], maximum = 1e18;

  long long int prod = 1;

  long long int flag = 0; 

  long long int num = 0;

  

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

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

    flag = (a[i] > maximum) ? 1 : flag;

    prod *= a[i];

    (a[i]) ? maximum /= a[i] : num = 1;

  }



  (num) ? puts("0") : ((flag) ? puts("-1") : printf("%lld\n", prod));

  return 0;

}
// Slower C++ solution:
 #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;





}

 

// Faster C++ solution for the same problem (measured speedup: 5.230484822747188x):
#include <stdio.h>



int main() {

  int x;

  scanf("%d", &x);

  long long int a[x], maximum = 1e18;

  long long int prod = 1;

  long long int flag = 0; 

  long long int num = 0;

  

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

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

    flag = (a[i] > maximum) ? 1 : flag;

    prod *= a[i];

    (a[i]) ? maximum /= a[i] : num = 1;

  }



  (num) ? puts("0") : ((flag) ? puts("-1") : printf("%lld\n", prod));

  return 0;

}