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: 4.678190846067363x):
#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>

using namespace std;

const unsigned long long maxn=1e18;

const int maxx=1e5+10;

int main()

{

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

	int n;

	cin>>n;

	int flag=0;

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

    {

    	cin>>a[i];

    	if(a[i]==0)

    	 flag=1;

    }

    if(flag)

    {

    	cout<<0<<endl;

    	return 0;

	}

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

    {

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

		 ans*=a[i];

        else

        {

            cout<<-1<<endl;

            return 0;

        }

    }

    cout<<ans<<endl;

    return 0;

}

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

int main (){

    long long int N; //test case

    long long int total=1;

    

    scanf("%lld",&N);

    long long int A[N]; //input nilainya

    

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

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

    }

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

        if(A[j] == 0){  //mirip seperti ?: (ternary operator)

            printf("0"); //angka berapapun kalo dikali 0, hasilnya tetap 0

            return 0;

        }

    }

    for(int k=0;k<N;k++){

        if(A[k]<=1000000000000000000/total){

            total = total*A[k];

            // apakah angka yang dikalikan itu < 10^18

       // apakah input <= 10^18/total

        } else {

            printf("-1");

            return 0;

        }

    }

    printf("%lld", total);

    

    

return 0;

}
// Slower C++ solution:
#pragma region

#include <algorithm>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <stack>

#include <string>

#include <vector>

typedef long long ll;

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

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

using namespace std;

#pragma endregion

int main() {

    IO;

    ll ans = 1;

    ll n;

    cin >> n;

    int flag = 0;

    while (n--) {

        ll x;

        cin >> x;

        if (!x) {

            cout << "0\n";

            return 0;

        }

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

            ans *= x;

        else

            flag = 1;

    }

    if (flag)

        cout << "-1\n";

    else

        cout << ans << endl;

}

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

int main (){

    long long int N; //test case

    long long int total=1;

    

    scanf("%lld",&N);

    long long int A[N]; //input nilainya

    

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

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

    }

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

        if(A[j] == 0){  //mirip seperti ?: (ternary operator)

            printf("0"); //angka berapapun kalo dikali 0, hasilnya tetap 0

            return 0;

        }

    }

    for(int k=0;k<N;k++){

        if(A[k]<=1000000000000000000/total){

            total = total*A[k];

            // apakah angka yang dikalikan itu < 10^18

       // apakah input <= 10^18/total

        } else {

            printf("-1");

            return 0;

        }

    }

    printf("%lld", total);

    

    

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;

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

    if (ULLONG_MAX / a < b) {

        return true;

    }



    unsigned long long ans = a*b;

    if (ans>MAXL) {

        return true;

    }

    return false;

}

 

int main() {

    int n;

    scanf("%d",&n);

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

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

        if (0==nums[i]) {

            printf("0\n");

            return 0;

        }

    }

 

    long long ans=1;

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

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

            printf("-1\n");

            return 0;

        }

        ans*=nums[i];

    }

 

    printf("%llu",ans);

 

    return 0;

}

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

int main (){

    long long int N; //test case

    long long int total=1;

    

    scanf("%lld",&N);

    long long int A[N]; //input nilainya

    

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

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

    }

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

        if(A[j] == 0){  //mirip seperti ?: (ternary operator)

            printf("0"); //angka berapapun kalo dikali 0, hasilnya tetap 0

            return 0;

        }

    }

    for(int k=0;k<N;k++){

        if(A[k]<=1000000000000000000/total){

            total = total*A[k];

            // apakah angka yang dikalikan itu < 10^18

       // apakah input <= 10^18/total

        } else {

            printf("-1");

            return 0;

        }

    }

    printf("%lld", total);

    

    

return 0;

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

using namespace std;

const unsigned long long maxn=1e18;

const int maxx=1e5+10;

int main()

{

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

	int n;

	cin>>n;

	int flag=0;

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

    {

    	cin>>a[i];

    	if(a[i]==0)

    	 flag=1;

    }

    if(flag)

    {

    	cout<<0<<endl;

    	return 0;

	}

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

    {

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

		 ans*=a[i];

        else

        {

            cout<<-1<<endl;

            return 0;

        }

    }

    cout<<ans<<endl;

    return 0;

}

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

int main (){

    long long int N, sum = 1;

    scanf("%lld",&N);



    long long int A[N];

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

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

    }



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

        if(A[i] == 0){

            printf("0");

            return 0;

        }

    }



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

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

            sum *= A[i];

        } else {

            printf("-1");

            return 0;

        }

    }

    printf("%lld", sum);



    return 0;

  }
// Slower C++ solution:
#pragma region

#include <algorithm>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <stack>

#include <string>

#include <vector>

typedef long long ll;

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

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

using namespace std;

#pragma endregion

int main() {

    IO;

    ll ans = 1;

    ll n;

    cin >> n;

    int flag = 0;

    while (n--) {

        ll x;

        cin >> x;

        if (!x) {

            cout << "0\n";

            return 0;

        }

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

            ans *= x;

        else

            flag = 1;

    }

    if (flag)

        cout << "-1\n";

    else

        cout << ans << endl;

}

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

int main (){

    long long int N, sum = 1;

    scanf("%lld",&N);



    long long int A[N];

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

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

    }



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

        if(A[i] == 0){

            printf("0");

            return 0;

        }

    }



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

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

            sum *= A[i];

        } else {

            printf("-1");

            return 0;

        }

    }

    printf("%lld", sum);



    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;

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

    if (ULLONG_MAX / a < b) {

        return true;

    }



    unsigned long long ans = a*b;

    if (ans>MAXL) {

        return true;

    }

    return false;

}

 

int main() {

    int n;

    scanf("%d",&n);

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

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

        if (0==nums[i]) {

            printf("0\n");

            return 0;

        }

    }

 

    long long ans=1;

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

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

            printf("-1\n");

            return 0;

        }

        ans*=nums[i];

    }

 

    printf("%llu",ans);

 

    return 0;

}

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

int main (){

    long long int N, sum = 1;

    scanf("%lld",&N);



    long long int A[N];

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

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

    }



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

        if(A[i] == 0){

            printf("0");

            return 0;

        }

    }



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

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

            sum *= A[i];

        } else {

            printf("-1");

            return 0;

        }

    }

    printf("%lld", sum);



    return 0;

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

using namespace std;

const unsigned long long maxn=1e18;

const int maxx=1e5+10;

int main()

{

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

	int n;

	cin>>n;

	int flag=0;

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

    {

    	cin>>a[i];

    	if(a[i]==0)

    	 flag=1;

    }

    if(flag)

    {

    	cout<<0<<endl;

    	return 0;

	}

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

    {

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

		 ans*=a[i];

        else

        {

            cout<<-1<<endl;

            return 0;

        }

    }

    cout<<ans<<endl;

    return 0;

}

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



int main () {

	int N;

	scanf("%d", &N);

	long long int ar[N], maximum =1e18, pRod = 1, flag = 0;

	long long int zero = 0;

	

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

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

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

		pRod *= ar[i];

		(ar[i]) ? maximum /= ar[i] : zero = 1;

	}

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

	return 0;

}
// Slower C++ solution:
#pragma region

#include <algorithm>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <stack>

#include <string>

#include <vector>

typedef long long ll;

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

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

using namespace std;

#pragma endregion

int main() {

    IO;

    ll ans = 1;

    ll n;

    cin >> n;

    int flag = 0;

    while (n--) {

        ll x;

        cin >> x;

        if (!x) {

            cout << "0\n";

            return 0;

        }

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

            ans *= x;

        else

            flag = 1;

    }

    if (flag)

        cout << "-1\n";

    else

        cout << ans << endl;

}

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



int main () {

	int N;

	scanf("%d", &N);

	long long int ar[N], maximum =1e18, pRod = 1, flag = 0;

	long long int zero = 0;

	

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

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

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

		pRod *= ar[i];

		(ar[i]) ? maximum /= ar[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;

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

    if (ULLONG_MAX / a < b) {

        return true;

    }



    unsigned long long ans = a*b;

    if (ans>MAXL) {

        return true;

    }

    return false;

}

 

int main() {

    int n;

    scanf("%d",&n);

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

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

        if (0==nums[i]) {

            printf("0\n");

            return 0;

        }

    }

 

    long long ans=1;

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

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

            printf("-1\n");

            return 0;

        }

        ans*=nums[i];

    }

 

    printf("%llu",ans);

 

    return 0;

}

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



int main () {

	int N;

	scanf("%d", &N);

	long long int ar[N], maximum =1e18, pRod = 1, flag = 0;

	long long int zero = 0;

	

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

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

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

		pRod *= ar[i];

		(ar[i]) ? maximum /= ar[i] : zero = 1;

	}

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

	return 0;

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

using namespace std;

const unsigned long long maxn=1e18;

const int maxx=1e5+10;

int main()

{

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

	int n;

	cin>>n;

	int flag=0;

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

    {

    	cin>>a[i];

    	if(a[i]==0)

    	 flag=1;

    }

    if(flag)

    {

    	cout<<0<<endl;

    	return 0;

	}

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

    {

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

		 ans*=a[i];

        else

        {

            cout<<-1<<endl;

            return 0;

        }

    }

    cout<<ans<<endl;

    return 0;

}

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



int main(){

    

    int kloadaNol = 0;

    int a;

    long long b, temp;

    long long ans = 1;

    scanf("%d", &a);



    long long arr[100000];

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

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

        if (arr[i] == 0){

            kloadaNol = 1;

        }

    }

    

    if (kloadaNol == 0){

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

			if(arr[i]<=1000000000000000000/ans){

				ans*=arr[i];

			}

            else{

            	printf("-1\n");

            	return 0;

			}

        }

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

    }

    else{

    	printf("0\n");

	}

	

	return 0;

}
// Slower C++ solution:
#pragma region

#include <algorithm>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <stack>

#include <string>

#include <vector>

typedef long long ll;

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

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

using namespace std;

#pragma endregion

int main() {

    IO;

    ll ans = 1;

    ll n;

    cin >> n;

    int flag = 0;

    while (n--) {

        ll x;

        cin >> x;

        if (!x) {

            cout << "0\n";

            return 0;

        }

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

            ans *= x;

        else

            flag = 1;

    }

    if (flag)

        cout << "-1\n";

    else

        cout << ans << endl;

}

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



int main(){

    

    int kloadaNol = 0;

    int a;

    long long b, temp;

    long long ans = 1;

    scanf("%d", &a);



    long long arr[100000];

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

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

        if (arr[i] == 0){

            kloadaNol = 1;

        }

    }

    

    if (kloadaNol == 0){

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

			if(arr[i]<=1000000000000000000/ans){

				ans*=arr[i];

			}

            else{

            	printf("-1\n");

            	return 0;

			}

        }

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

    }

    else{

    	printf("0\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;

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

    if (ULLONG_MAX / a < b) {

        return true;

    }



    unsigned long long ans = a*b;

    if (ans>MAXL) {

        return true;

    }

    return false;

}

 

int main() {

    int n;

    scanf("%d",&n);

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

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

        if (0==nums[i]) {

            printf("0\n");

            return 0;

        }

    }

 

    long long ans=1;

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

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

            printf("-1\n");

            return 0;

        }

        ans*=nums[i];

    }

 

    printf("%llu",ans);

 

    return 0;

}

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



int main(){

    

    int kloadaNol = 0;

    int a;

    long long b, temp;

    long long ans = 1;

    scanf("%d", &a);



    long long arr[100000];

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

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

        if (arr[i] == 0){

            kloadaNol = 1;

        }

    }

    

    if (kloadaNol == 0){

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

			if(arr[i]<=1000000000000000000/ans){

				ans*=arr[i];

			}

            else{

            	printf("-1\n");

            	return 0;

			}

        }

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

    }

    else{

    	printf("0\n");

	}

	

	return 0;

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

using namespace std;

const unsigned long long maxn=1e18;

const int maxx=1e5+10;

int main()

{

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

	int n;

	cin>>n;

	int flag=0;

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

    {

    	cin>>a[i];

    	if(a[i]==0)

    	 flag=1;

    }

    if(flag)

    {

    	cout<<0<<endl;

    	return 0;

	}

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

    {

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

		 ans*=a[i];

        else

        {

            cout<<-1<<endl;

            return 0;

        }

    }

    cout<<ans<<endl;

    return 0;

}

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

int main() {

  int n;

  scanf("%d", &n);

  long long int arr[n], maximum = 1e18, prod = 1, flags = 0, zero = 0;

  

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

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

    flags = arr[i] > maximum ? 1 : flags;

    prod *= arr[i];

    arr[i] ? maximum/= arr[i] : zero = 1;

  }



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

  return 0;

}
// Slower C++ solution:
#pragma region

#include <algorithm>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <stack>

#include <string>

#include <vector>

typedef long long ll;

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

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

using namespace std;

#pragma endregion

int main() {

    IO;

    ll ans = 1;

    ll n;

    cin >> n;

    int flag = 0;

    while (n--) {

        ll x;

        cin >> x;

        if (!x) {

            cout << "0\n";

            return 0;

        }

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

            ans *= x;

        else

            flag = 1;

    }

    if (flag)

        cout << "-1\n";

    else

        cout << ans << endl;

}

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

int main() {

  int n;

  scanf("%d", &n);

  long long int arr[n], maximum = 1e18, prod = 1, flags = 0, zero = 0;

  

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

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

    flags = arr[i] > maximum ? 1 : flags;

    prod *= arr[i];

    arr[i] ? maximum/= arr[i] : zero = 1;

  }



  (zero) ? puts("0") : ((flags) ? 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;

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

    if (ULLONG_MAX / a < b) {

        return true;

    }



    unsigned long long ans = a*b;

    if (ans>MAXL) {

        return true;

    }

    return false;

}

 

int main() {

    int n;

    scanf("%d",&n);

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

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

        if (0==nums[i]) {

            printf("0\n");

            return 0;

        }

    }

 

    long long ans=1;

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

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

            printf("-1\n");

            return 0;

        }

        ans*=nums[i];

    }

 

    printf("%llu",ans);

 

    return 0;

}

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

int main() {

  int n;

  scanf("%d", &n);

  long long int arr[n], maximum = 1e18, prod = 1, flags = 0, zero = 0;

  

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

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

    flags = arr[i] > maximum ? 1 : flags;

    prod *= arr[i];

    arr[i] ? maximum/= arr[i] : zero = 1;

  }



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

  return 0;

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

using namespace std;

const unsigned long long maxn=1e18;

const int maxx=1e5+10;

int main()

{

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

	int n;

	cin>>n;

	int flag=0;

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

    {

    	cin>>a[i];

    	if(a[i]==0)

    	 flag=1;

    }

    if(flag)

    {

    	cout<<0<<endl;

    	return 0;

	}

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

    {

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

		 ans*=a[i];

        else

        {

            cout<<-1<<endl;

            return 0;

        }

    }

    cout<<ans<<endl;

    return 0;

}

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



int main() {

  int N;

  scanf("%d", &N);

  long long int array[N], max = 1e18, p = 1, f = 0, z = 0;

  

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

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

    f = (array[i] > max) ? 1 : f;

    p *= array[i];

    (array[i]) ? max /= array[i] : z = 1;

  }



  (z) ? puts("0") : ((f) ? puts("-1") : printf("%lld\n", p));

  return 0;

}
// Slower C++ solution:
#pragma region

#include <algorithm>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <stack>

#include <string>

#include <vector>

typedef long long ll;

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

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

using namespace std;

#pragma endregion

int main() {

    IO;

    ll ans = 1;

    ll n;

    cin >> n;

    int flag = 0;

    while (n--) {

        ll x;

        cin >> x;

        if (!x) {

            cout << "0\n";

            return 0;

        }

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

            ans *= x;

        else

            flag = 1;

    }

    if (flag)

        cout << "-1\n";

    else

        cout << ans << endl;

}

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



int main() {

  int N;

  scanf("%d", &N);

  long long int array[N], max = 1e18, p = 1, f = 0, z = 0;

  

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

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

    f = (array[i] > max) ? 1 : f;

    p *= array[i];

    (array[i]) ? max /= array[i] : z = 1;

  }



  (z) ? puts("0") : ((f) ? puts("-1") : printf("%lld\n", p));

  return 0;

}