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



int main()

{

    int N, i, j, test;

    unsigned long long mul;

    long long A[100001], tt=1000000000000000000;



    scanf("%d", &N);





    mul=1;

    test=1;

    for(i=1; i<=N; i++){

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

    }

    for(i=1; i<=N; i++){

        if(A[i]==0){

            test=0;

            break;

        }



        if(tt/mul >= A[i])

        {

            mul *= A[i];

        }

        else

            test=2;





    }



        if(test==0)

            printf("0\n");

        else if(test==1)

            printf("%llu\n", mul);

        else if(test==2)

            printf("-1\n");



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



int main()

{

    int N, i, j, test;

    unsigned long long mul;

    long long A[100001], tt=1000000000000000000;



    scanf("%d", &N);





    mul=1;

    test=1;

    for(i=1; i<=N; i++){

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

    }

    for(i=1; i<=N; i++){

        if(A[i]==0){

            test=0;

            break;

        }



        if(tt/mul >= A[i])

        {

            mul *= A[i];

        }

        else

            test=2;





    }



        if(test==0)

            printf("0\n");

        else if(test==1)

            printf("%llu\n", mul);

        else if(test==2)

            printf("-1\n");



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



int main()

{

    int N, i, j, test;

    unsigned long long mul;

    long long A[100001], tt=1000000000000000000;



    scanf("%d", &N);





    mul=1;

    test=1;

    for(i=1; i<=N; i++){

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

    }

    for(i=1; i<=N; i++){

        if(A[i]==0){

            test=0;

            break;

        }



        if(tt/mul >= A[i])

        {

            mul *= A[i];

        }

        else

            test=2;





    }



        if(test==0)

            printf("0\n");

        else if(test==1)

            printf("%llu\n", mul);

        else if(test==2)

            printf("-1\n");



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



int main()

{

    int N, i, j, test;

    unsigned long long mul;

    long long A[100001], tt=1000000000000000000;



    scanf("%d", &N);





    mul=1;

    test=1;

    for(i=1; i<=N; i++){

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

    }

    for(i=1; i<=N; i++){

        if(A[i]==0){

            test=0;

            break;

        }



        if(tt/mul >= A[i])

        {

            mul *= A[i];

        }

        else

            test=2;





    }



        if(test==0)

            printf("0\n");

        else if(test==1)

            printf("%llu\n", mul);

        else if(test==2)

            printf("-1\n");



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



int main()

{

    int N, i, j, test;

    unsigned long long mul;

    long long A[100001], tt=1000000000000000000;



    scanf("%d", &N);





    mul=1;

    test=1;

    for(i=1; i<=N; i++){

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

    }

    for(i=1; i<=N; i++){

        if(A[i]==0){

            test=0;

            break;

        }



        if(tt/mul >= A[i])

        {

            mul *= A[i];

        }

        else

            test=2;





    }



        if(test==0)

            printf("0\n");

        else if(test==1)

            printf("%llu\n", mul);

        else if(test==2)

            printf("-1\n");



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



int main()

{

    int N, i, j, test;

    unsigned long long mul;

    long long A[100001], tt=1000000000000000000;



    scanf("%d", &N);





    mul=1;

    test=1;

    for(i=1; i<=N; i++){

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

    }

    for(i=1; i<=N; i++){

        if(A[i]==0){

            test=0;

            break;

        }



        if(tt/mul >= A[i])

        {

            mul *= A[i];

        }

        else

            test=2;





    }



        if(test==0)

            printf("0\n");

        else if(test==1)

            printf("%llu\n", mul);

        else if(test==2)

            printf("-1\n");



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



#define limit 1000000000000000000



int main()

{

    long long int a[100000],i,n,pro;



    scanf("%lld",&n);



    for(i=0,pro=1;i<n;i++)

    {

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



        if(a[i]==0)

        {

            printf("0");

            return 0;

        }

    }



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

    {

        if(pro>limit/a[i])

        {

            printf("-1");

            return 0;

        }



        else

            pro = pro * a[i];



    }





    printf("%lld",pro);

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



#define limit 1000000000000000000



int main()

{

    long long int a[100000],i,n,pro;



    scanf("%lld",&n);



    for(i=0,pro=1;i<n;i++)

    {

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



        if(a[i]==0)

        {

            printf("0");

            return 0;

        }

    }



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

    {

        if(pro>limit/a[i])

        {

            printf("-1");

            return 0;

        }



        else

            pro = pro * a[i];



    }





    printf("%lld",pro);

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



#define limit 1000000000000000000



int main()

{

    long long int a[100000],i,n,pro;



    scanf("%lld",&n);



    for(i=0,pro=1;i<n;i++)

    {

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



        if(a[i]==0)

        {

            printf("0");

            return 0;

        }

    }



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

    {

        if(pro>limit/a[i])

        {

            printf("-1");

            return 0;

        }



        else

            pro = pro * a[i];



    }





    printf("%lld",pro);

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



#define limit 1000000000000000000



int main()

{

    long long int a[100000],i,n,pro;



    scanf("%lld",&n);



    for(i=0,pro=1;i<n;i++)

    {

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



        if(a[i]==0)

        {

            printf("0");

            return 0;

        }

    }



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

    {

        if(pro>limit/a[i])

        {

            printf("-1");

            return 0;

        }



        else

            pro = pro * a[i];



    }





    printf("%lld",pro);

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



#define limit 1000000000000000000



int main()

{

    long long int a[100000],i,n,pro;



    scanf("%lld",&n);



    for(i=0,pro=1;i<n;i++)

    {

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



        if(a[i]==0)

        {

            printf("0");

            return 0;

        }

    }



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

    {

        if(pro>limit/a[i])

        {

            printf("-1");

            return 0;

        }



        else

            pro = pro * a[i];



    }





    printf("%lld",pro);

    return 0;

}