stablegradients/pie-gem5-pairs huggingface dataset:
// 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.311058661685318x):
#include <stdio.h>



int main() {

  int n;

  scanf("%d", &n);

  long long int arr[n], max = 1e18, res = 1, check = 0, zero = 0;

  

  int c;

  for (c = 0; c < n; c++) {

    scanf("%lld", &arr[c]);

    check = (arr[c] > max) ? 1 : check;

    res *= arr[c];

    (arr[c]) ? max /= arr[c] : zero = 1;

  }



  (zero) ? printf("0\n") : ((check) ? printf("-1\n") : printf("%lld\n", res));

  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.22358610936682x):
#include <stdio.h>



int main() {

  int n;

  scanf("%d", &n);

  long long int arr[n], max = 1e18, res = 1, check = 0, zero = 0;

  

  int c;

  for (c = 0; c < n; c++) {

    scanf("%lld", &arr[c]);

    check = (arr[c] > max) ? 1 : check;

    res *= arr[c];

    (arr[c]) ? max /= arr[c] : zero = 1;

  }



  (zero) ? printf("0\n") : ((check) ? printf("-1\n") : printf("%lld\n", res));

  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.161101393810641x):
#include<stdio.h>



int main (){

	

	int number;

  	scanf("%d", &number);

  	

	long long int arr[number], max = 1e18, prod = 1, flag = 0, zero = 0; //1e18 = 10^18

	// flag utk nandain kalau sum nya >1e18 atau tidak

  

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

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

    flag = (arr[i] > max) ? 1 : flag;

    prod *= arr[i];

    (arr[i]) ? max /= arr[i] : zero = 1;

  }



  (zero) ? 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 number;

  	scanf("%d", &number);

  	

	long long int arr[number], max = 1e18, prod = 1, flag = 0, zero = 0; //1e18 = 10^18

	// flag utk nandain kalau sum nya >1e18 atau tidak

  

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

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

    flag = (arr[i] > max) ? 1 : flag;

    prod *= arr[i];

    (arr[i]) ? max /= arr[i] : zero = 1;

  }



  (zero) ? 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 (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.230509952809643x):
#include<stdio.h>



int main (){

	

	int number;

  	scanf("%d", &number);

  	

	long long int arr[number], max = 1e18, prod = 1, flag = 0, zero = 0; //1e18 = 10^18

	// flag utk nandain kalau sum nya >1e18 atau tidak

  

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

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

    flag = (arr[i] > max) ? 1 : flag;

    prod *= arr[i];

    (arr[i]) ? max /= arr[i] : zero = 1;

  }



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

  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.16086728153143x):
#include<stdio.h>



int main (){

	

	int number;

  	scanf("%d", &number);

  	

	long long int arr[number], max = 1e18, prod = 1, flag = 0, zero = 0; //1e18 = 10^18

	// flag utk nandain kalau sum nya >1e18 atau tidak

  

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

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

    flag = (arr[i] > max) ? 1 : flag;

    prod *= arr[i];

    (arr[i]) ? max /= arr[i] : zero = 1;

  }



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

  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.310448036040017x):
#include<stdio.h>



int main (){

	

	int number;

  	scanf("%d", &number);

  	

	long long int arr[number], max = 1e18, prod = 1, flag = 0, zero = 0; //1e18 = 10^18

	// flag utk nandain kalau sum nya >1e18 atau tidak

  

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

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

    flag = (arr[i] > max) ? 1 : flag;

    prod *= arr[i];

    (arr[i]) ? max /= arr[i] : zero = 1;

  }



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

  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.2229855406587715x):
#include<stdio.h>



int main (){

	

	int number;

  	scanf("%d", &number);

  	

	long long int arr[number], max = 1e18, prod = 1, flag = 0, zero = 0; //1e18 = 10^18

	// flag utk nandain kalau sum nya >1e18 atau tidak

  

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

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

    flag = (arr[i] > max) ? 1 : flag;

    prod *= arr[i];

    (arr[i]) ? max /= arr[i] : zero = 1;

  }



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

  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.1669480765151405x):
#include<stdio.h>

int main(){

	long long int t;

	scanf("%lld",&t);

	long long int number[t]={0};

	long long int hasil=1;

	

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

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

	}

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

		if(number[i]==0){

			printf("0\n");

			return 0;

		}

	}

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

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

			hasil=hasil*number[i];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",hasil);

	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.2364101055145404x):
#include<stdio.h>

int main(){

	long long int t;

	scanf("%lld",&t);

	long long int number[t]={0};

	long long int hasil=1;

	

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

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

	}

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

		if(number[i]==0){

			printf("0\n");

			return 0;

		}

	}

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

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

			hasil=hasil*number[i];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",hasil);

	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.236435264045242x):
#include<stdio.h>

int main(){

	long long int t;

	scanf("%lld",&t);

	long long int number[t]={0};

	long long int hasil=1;

	

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

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

	}

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

		if(number[i]==0){

			printf("0\n");

			return 0;

		}

	}

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

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

			hasil=hasil*number[i];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",hasil);

	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.166713699025055x):
#include<stdio.h>

int main(){

	long long int t;

	scanf("%lld",&t);

	long long int number[t]={0};

	long long int hasil=1;

	

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

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

	}

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

		if(number[i]==0){

			printf("0\n");

			return 0;

		}

	}

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

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

			hasil=hasil*number[i];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",hasil);

	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.316463904033368x):
#include<stdio.h>

int main(){

	long long int t;

	scanf("%lld",&t);

	long long int number[t]={0};

	long long int hasil=1;

	

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

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

	}

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

		if(number[i]==0){

			printf("0\n");

			return 0;

		}

	}

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

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

			hasil=hasil*number[i];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",hasil);

	return 0;

}