stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#pragma GCC optimize("O3")

#pragma G++ optimize("O3")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

#define ld long double

#define ull unsigned ll

#define mst(a, b) memset((a), (b), sizeof(a))

#define mp(a, b) make_pair(a, b)

#define pi acos(-1)

#define pii pair<int, int>

#define pll pair<ll, ll>

#define pdd pair<double, double>

#define vi vector<int>

#define vl vector<ll>

#define pb push_back

#define lson l, mid, rt << 1

#define rson mid + 1, r, rt << 1 | 1

const int INF = 0x3f3f3f3f;

const double eps = 1e-8;

const int maxn = 1e3 + 7;

const int maxm = 1e5 + 7;

const int mod = 1e9 + 7;

#define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

ll a[maxm];

__int128_t ans;

int main()

{

    IO;

    int n;

    cin>>n;

    ans=1;

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

    {

        cin>>a[i];

        if (a[i]==0)

        {

            cout<<0<<endl;

            return 0;

        }

    }

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

    {

        ans*=a[i];

        if (ans>(ll)1000000000000000000)

        {

            cout<<-1<<endl;

            return 0;

        }

    }

    cout<<(ll)ans<<endl;

    return 0;

}

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



int main() {

  int a;

  scanf("%d", &a);

  long long int arr[a], max = 1e18, prod = 1, flag = 0, kosong = 0;

  

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

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

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

    prod *= arr[i];

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

  }



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

  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n;

    cin >> n;

    long long a[n+1];

    int z = 0;

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

    {

        cin >> a[i];

    }

    sort(a, a+n);

    if(a[0] == 0)

        cout << "0" << endl;

    else

    {

        long long ans = 1;

        long long z = 1000000000000000000/n;



        int flag = 0;

        for(int i = n - 1; i >= 0; i--)

        {

            if(a[i] > z)

            {

                flag = 1;

                break;

            }

            ans *= a[i];

            z = 1000000000000000000/ans;

        }

        if(flag == 1 || ans > 1000000000000000000)

            cout << "-1" << endl;

        else

            cout << ans << endl;

    }

}


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



int main() {

  int a;

  scanf("%d", &a);

  long long int arr[a], max = 1e18, prod = 1, flag = 0, kosong = 0;

  

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

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

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

    prod *= arr[i];

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

  }



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

  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

long long a [100010];

int main (){

int n;

scanf("%d",&n);

for(int i=0;i<n;i++) scanf("%lld",&a[i]);

int zero =0;



for(int i=0;i<n;i++)if(a[i]==0) zero ++;

if(zero >0){

// a[i] contains 0

printf("0\n");

return 0;

}

long long prod =1;

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

if(a[i ] <=1000000000000000000/ prod ){

// This condition is equivalent to prod*a[i] <=10ˆ18

prod *=a[i];

}else{

printf("-1\n");

return 0;

}

}

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

}


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



int main() {

  int a;

  scanf("%d", &a);

  long long int arr[a], max = 1e18, prod = 1, flag = 0, kosong = 0;

  

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

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

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

    prod *= arr[i];

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

  }



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

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main ()

{

    int n,Count=0;

    long long int a [100010];

    cin>>n;

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

    {

        cin>>a[i];

        if(a[i]==0){Count++;}

    }

    if(Count>0){cout<<0<<endl;return 0;}

    long long int sum=1;

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

    {

        if(a[i]<=1000000000000000000/sum )

        {

            sum=sum*a[i];

        }

        else

        {

           cout<<-1<<endl;

            return 0;

        }

    }

   cout<<sum<<endl;

}


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



int main() {

  int a;

  scanf("%d", &a);

  long long int arr[a], max = 1e18, prod = 1, flag = 0, kosong = 0;

  

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

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

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

    prod *= arr[i];

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

  }



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

  return 0;

}
// Slower C++ solution:
//sppsfver - 05.08.2020

#include <bits/stdc++.h>

using namespace std;



using ll = long long;

using pll = pair <ll, ll>;



ll n, a, ans = 1;

bool flag, zero;



int main() {

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



    cin >> n;

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

        cin >> a;

        if (a == 0) return cout << 0 << endl, 0;

        a <= (ll)(1e18)/ans ? ans *= a : flag = 1;

    }

    cout << (flag ? -1 : ans) << endl;

	return 0;

}


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



int main() {

  int a;

  scanf("%d", &a);

  long long int arr[a], max = 1e18, prod = 1, flag = 0, kosong = 0;

  

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

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

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

    prod *= arr[i];

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

  }



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

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



long long eps = 1000000000000000000;

long long a[100050];



int main()

{

	int n;

	cin>>n;

	int flag = 0;

	long long ans = 1;

	

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

		cin>>a[i];

	}

	

	sort(a,a+n);

	

	if(a[0] == 0) cout<<0<<endl;

	else{

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

			if(a[i] > eps/ans){

				cout<<-1<<endl;

				return 0;

			}

			else ans *= a[i];

		}

		cout<<ans<<endl;

	}

	

	return 0;

} 

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



int main() {

  int Z;

  scanf("%d", &Z);

  long long int arr[Z], max = 1e18, prods = 1, flags = 0, zeroo = 0;

  

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



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

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

    prods *= arr[i];

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



  }



  (zeroo) ? puts("0") : ((flags) ? puts("-1") : printf("%lld\n", prods));

  return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,i;

	cin>>n;

	long long ans=1;

	long long a[n];

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

		cin>>a[i];

		if(a[i]==0){

			cout<<0;

			return 0;

		}

	}

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

		if(1000000000000000000/ans<a[i]){

			cout<<-1;

			return 0;

		}

		ans*=a[i];

	}

	cout<<ans;

}

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



int main() {

  int Z;

  scanf("%d", &Z);

  long long int arr[Z], max = 1e18, prods = 1, flags = 0, zeroo = 0;

  

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



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

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

    prods *= arr[i];

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



  }



  (zeroo) ? puts("0") : ((flags) ? puts("-1") : printf("%lld\n", prods));

  return 0;

}
// Slower C++ solution:
#pragma GCC optimize("O3")

#pragma G++ optimize("O3")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

#define ld long double

#define ull unsigned ll

#define mst(a, b) memset((a), (b), sizeof(a))

#define mp(a, b) make_pair(a, b)

#define pi acos(-1)

#define pii pair<int, int>

#define pll pair<ll, ll>

#define pdd pair<double, double>

#define vi vector<int>

#define vl vector<ll>

#define pb push_back

#define lson l, mid, rt << 1

#define rson mid + 1, r, rt << 1 | 1

const int INF = 0x3f3f3f3f;

const double eps = 1e-8;

const int maxn = 1e3 + 7;

const int maxm = 1e5 + 7;

const int mod = 1e9 + 7;

#define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

ll a[maxm];

__int128_t ans;

int main()

{

    IO;

    int n;

    cin>>n;

    ans=1;

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

    {

        cin>>a[i];

        if (a[i]==0)

        {

            cout<<0<<endl;

            return 0;

        }

    }

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

    {

        ans*=a[i];

        if (ans>(ll)1000000000000000000)

        {

            cout<<-1<<endl;

            return 0;

        }

    }

    cout<<(ll)ans<<endl;

    return 0;

}

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



int main() {

  int Z;

  scanf("%d", &Z);

  long long int arr[Z], max = 1e18, prods = 1, flags = 0, zeroo = 0;

  

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



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

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

    prods *= arr[i];

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



  }



  (zeroo) ? puts("0") : ((flags) ? puts("-1") : printf("%lld\n", prods));

  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n;

    cin >> n;

    long long a[n+1];

    int z = 0;

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

    {

        cin >> a[i];

    }

    sort(a, a+n);

    if(a[0] == 0)

        cout << "0" << endl;

    else

    {

        long long ans = 1;

        long long z = 1000000000000000000/n;



        int flag = 0;

        for(int i = n - 1; i >= 0; i--)

        {

            if(a[i] > z)

            {

                flag = 1;

                break;

            }

            ans *= a[i];

            z = 1000000000000000000/ans;

        }

        if(flag == 1 || ans > 1000000000000000000)

            cout << "-1" << endl;

        else

            cout << ans << endl;

    }

}


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



int main() {

  int Z;

  scanf("%d", &Z);

  long long int arr[Z], max = 1e18, prods = 1, flags = 0, zeroo = 0;

  

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



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

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

    prods *= arr[i];

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



  }



  (zeroo) ? puts("0") : ((flags) ? puts("-1") : printf("%lld\n", prods));

  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

long long a [100010];

int main (){

int n;

scanf("%d",&n);

for(int i=0;i<n;i++) scanf("%lld",&a[i]);

int zero =0;



for(int i=0;i<n;i++)if(a[i]==0) zero ++;

if(zero >0){

// a[i] contains 0

printf("0\n");

return 0;

}

long long prod =1;

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

if(a[i ] <=1000000000000000000/ prod ){

// This condition is equivalent to prod*a[i] <=10ˆ18

prod *=a[i];

}else{

printf("-1\n");

return 0;

}

}

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

}


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



int main() {

  int Z;

  scanf("%d", &Z);

  long long int arr[Z], max = 1e18, prods = 1, flags = 0, zeroo = 0;

  

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



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

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

    prods *= arr[i];

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



  }



  (zeroo) ? puts("0") : ((flags) ? puts("-1") : printf("%lld\n", prods));

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main ()

{

    int n,Count=0;

    long long int a [100010];

    cin>>n;

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

    {

        cin>>a[i];

        if(a[i]==0){Count++;}

    }

    if(Count>0){cout<<0<<endl;return 0;}

    long long int sum=1;

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

    {

        if(a[i]<=1000000000000000000/sum )

        {

            sum=sum*a[i];

        }

        else

        {

           cout<<-1<<endl;

            return 0;

        }

    }

   cout<<sum<<endl;

}


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



int main() {

  int Z;

  scanf("%d", &Z);

  long long int arr[Z], max = 1e18, prods = 1, flags = 0, zeroo = 0;

  

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



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

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

    prods *= arr[i];

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



  }



  (zeroo) ? puts("0") : ((flags) ? puts("-1") : printf("%lld\n", prods));

  return 0;

}
// Slower C++ solution:
//sppsfver - 05.08.2020

#include <bits/stdc++.h>

using namespace std;



using ll = long long;

using pll = pair <ll, ll>;



ll n, a, ans = 1;

bool flag, zero;



int main() {

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



    cin >> n;

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

        cin >> a;

        if (a == 0) return cout << 0 << endl, 0;

        a <= (ll)(1e18)/ans ? ans *= a : flag = 1;

    }

    cout << (flag ? -1 : ans) << endl;

	return 0;

}


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



int main() {

  int Z;

  scanf("%d", &Z);

  long long int arr[Z], max = 1e18, prods = 1, flags = 0, zeroo = 0;

  

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



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

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

    prods *= arr[i];

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



  }



  (zeroo) ? puts("0") : ((flags) ? puts("-1") : printf("%lld\n", prods));

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



long long eps = 1000000000000000000;

long long a[100050];



int main()

{

	int n;

	cin>>n;

	int flag = 0;

	long long ans = 1;

	

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

		cin>>a[i];

	}

	

	sort(a,a+n);

	

	if(a[0] == 0) cout<<0<<endl;

	else{

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

			if(a[i] > eps/ans){

				cout<<-1<<endl;

				return 0;

			}

			else ans *= a[i];

		}

		cout<<ans<<endl;

	}

	

	return 0;

} 

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



int main(){

	long long int x;

	scanf("%lld", &x);

	long long int x1[x];

	long long int x2 = 1;

	long long int max = 1000000000000000000;

	

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

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

	}

	

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

		if(x1[a1]==0){

			printf("0\n");

			return 0;

		}

		

	}

	

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

		if(x1[a2]<=max/x2){

			x2= x2*x1[a2];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",x2);

	

	

	

	

	

	

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,i;

	cin>>n;

	long long ans=1;

	long long a[n];

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

		cin>>a[i];

		if(a[i]==0){

			cout<<0;

			return 0;

		}

	}

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

		if(1000000000000000000/ans<a[i]){

			cout<<-1;

			return 0;

		}

		ans*=a[i];

	}

	cout<<ans;

}

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



int main(){

	long long int x;

	scanf("%lld", &x);

	long long int x1[x];

	long long int x2 = 1;

	long long int max = 1000000000000000000;

	

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

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

	}

	

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

		if(x1[a1]==0){

			printf("0\n");

			return 0;

		}

		

	}

	

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

		if(x1[a2]<=max/x2){

			x2= x2*x1[a2];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",x2);

	

	

	

	

	

	

	return 0;

}
// Slower C++ solution:
#pragma GCC optimize("O3")

#pragma G++ optimize("O3")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

#define ld long double

#define ull unsigned ll

#define mst(a, b) memset((a), (b), sizeof(a))

#define mp(a, b) make_pair(a, b)

#define pi acos(-1)

#define pii pair<int, int>

#define pll pair<ll, ll>

#define pdd pair<double, double>

#define vi vector<int>

#define vl vector<ll>

#define pb push_back

#define lson l, mid, rt << 1

#define rson mid + 1, r, rt << 1 | 1

const int INF = 0x3f3f3f3f;

const double eps = 1e-8;

const int maxn = 1e3 + 7;

const int maxm = 1e5 + 7;

const int mod = 1e9 + 7;

#define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

ll a[maxm];

__int128_t ans;

int main()

{

    IO;

    int n;

    cin>>n;

    ans=1;

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

    {

        cin>>a[i];

        if (a[i]==0)

        {

            cout<<0<<endl;

            return 0;

        }

    }

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

    {

        ans*=a[i];

        if (ans>(ll)1000000000000000000)

        {

            cout<<-1<<endl;

            return 0;

        }

    }

    cout<<(ll)ans<<endl;

    return 0;

}

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



int main(){

	long long int x;

	scanf("%lld", &x);

	long long int x1[x];

	long long int x2 = 1;

	long long int max = 1000000000000000000;

	

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

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

	}

	

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

		if(x1[a1]==0){

			printf("0\n");

			return 0;

		}

		

	}

	

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

		if(x1[a2]<=max/x2){

			x2= x2*x1[a2];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",x2);

	

	

	

	

	

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n;

    cin >> n;

    long long a[n+1];

    int z = 0;

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

    {

        cin >> a[i];

    }

    sort(a, a+n);

    if(a[0] == 0)

        cout << "0" << endl;

    else

    {

        long long ans = 1;

        long long z = 1000000000000000000/n;



        int flag = 0;

        for(int i = n - 1; i >= 0; i--)

        {

            if(a[i] > z)

            {

                flag = 1;

                break;

            }

            ans *= a[i];

            z = 1000000000000000000/ans;

        }

        if(flag == 1 || ans > 1000000000000000000)

            cout << "-1" << endl;

        else

            cout << ans << endl;

    }

}


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



int main(){

	long long int x;

	scanf("%lld", &x);

	long long int x1[x];

	long long int x2 = 1;

	long long int max = 1000000000000000000;

	

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

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

	}

	

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

		if(x1[a1]==0){

			printf("0\n");

			return 0;

		}

		

	}

	

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

		if(x1[a2]<=max/x2){

			x2= x2*x1[a2];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",x2);

	

	

	

	

	

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

long long a [100010];

int main (){

int n;

scanf("%d",&n);

for(int i=0;i<n;i++) scanf("%lld",&a[i]);

int zero =0;



for(int i=0;i<n;i++)if(a[i]==0) zero ++;

if(zero >0){

// a[i] contains 0

printf("0\n");

return 0;

}

long long prod =1;

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

if(a[i ] <=1000000000000000000/ prod ){

// This condition is equivalent to prod*a[i] <=10ˆ18

prod *=a[i];

}else{

printf("-1\n");

return 0;

}

}

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

}


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



int main(){

	long long int x;

	scanf("%lld", &x);

	long long int x1[x];

	long long int x2 = 1;

	long long int max = 1000000000000000000;

	

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

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

	}

	

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

		if(x1[a1]==0){

			printf("0\n");

			return 0;

		}

		

	}

	

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

		if(x1[a2]<=max/x2){

			x2= x2*x1[a2];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",x2);

	

	

	

	

	

	

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main ()

{

    int n,Count=0;

    long long int a [100010];

    cin>>n;

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

    {

        cin>>a[i];

        if(a[i]==0){Count++;}

    }

    if(Count>0){cout<<0<<endl;return 0;}

    long long int sum=1;

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

    {

        if(a[i]<=1000000000000000000/sum )

        {

            sum=sum*a[i];

        }

        else

        {

           cout<<-1<<endl;

            return 0;

        }

    }

   cout<<sum<<endl;

}


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



int main(){

	long long int x;

	scanf("%lld", &x);

	long long int x1[x];

	long long int x2 = 1;

	long long int max = 1000000000000000000;

	

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

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

	}

	

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

		if(x1[a1]==0){

			printf("0\n");

			return 0;

		}

		

	}

	

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

		if(x1[a2]<=max/x2){

			x2= x2*x1[a2];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",x2);

	

	

	

	

	

	

	return 0;

}
// Slower C++ solution:
//sppsfver - 05.08.2020

#include <bits/stdc++.h>

using namespace std;



using ll = long long;

using pll = pair <ll, ll>;



ll n, a, ans = 1;

bool flag, zero;



int main() {

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



    cin >> n;

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

        cin >> a;

        if (a == 0) return cout << 0 << endl, 0;

        a <= (ll)(1e18)/ans ? ans *= a : flag = 1;

    }

    cout << (flag ? -1 : ans) << endl;

	return 0;

}


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



int main(){

	long long int x;

	scanf("%lld", &x);

	long long int x1[x];

	long long int x2 = 1;

	long long int max = 1000000000000000000;

	

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

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

	}

	

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

		if(x1[a1]==0){

			printf("0\n");

			return 0;

		}

		

	}

	

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

		if(x1[a2]<=max/x2){

			x2= x2*x1[a2];

		}

		else{

			printf("-1\n");

			return 0;

		}

	}

	printf("%lld",x2);

	

	

	

	

	

	

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



long long eps = 1000000000000000000;

long long a[100050];



int main()

{

	int n;

	cin>>n;

	int flag = 0;

	long long ans = 1;

	

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

		cin>>a[i];

	}

	

	sort(a,a+n);

	

	if(a[0] == 0) cout<<0<<endl;

	else{

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

			if(a[i] > eps/ans){

				cout<<-1<<endl;

				return 0;

			}

			else ans *= a[i];

		}

		cout<<ans<<endl;

	}

	

	return 0;

} 

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



int main ()

{

	int n;

	scanf("%d", &n);

	

	long long int A1[n];

	long long int A2=1;

	long long int max=1000000000000000000;

	

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

	{

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

	}

	

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

	{

		if(A1[j]==0)

		{

			printf("0\n");

			return 0;

		}	

	}	

	

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

	{

		if(A1[k] <= max/A2)

		{

			A2 *= A1[k];	

		}

		

		else 

		{

			printf("-1\n");

			return 0;

		}

	}	

	

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

	

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,i;

	cin>>n;

	long long ans=1;

	long long a[n];

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

		cin>>a[i];

		if(a[i]==0){

			cout<<0;

			return 0;

		}

	}

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

		if(1000000000000000000/ans<a[i]){

			cout<<-1;

			return 0;

		}

		ans*=a[i];

	}

	cout<<ans;

}

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



int main ()

{

	int n;

	scanf("%d", &n);

	

	long long int A1[n];

	long long int A2=1;

	long long int max=1000000000000000000;

	

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

	{

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

	}

	

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

	{

		if(A1[j]==0)

		{

			printf("0\n");

			return 0;

		}	

	}	

	

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

	{

		if(A1[k] <= max/A2)

		{

			A2 *= A1[k];	

		}

		

		else 

		{

			printf("-1\n");

			return 0;

		}

	}	

	

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

	

	return 0;

}