stablegradients/pie-gem5-pairs huggingface dataset:
// 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 t, sum = 1;

  scanf("%lld", &t);



  long long int n[t];

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

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

  }



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

    if(n[i] == 0) {

      printf("0");

      return 0;

    }

  }



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

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

      sum *= n[i];

    }

    else {

      printf("-1");

      return 0;

    }

  }

  printf("%lld", sum);

  return 0;

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

using namespace std;

long long x;

__int128 ans=1; 

long long a[100005];

void print(__int128 x)

{

	if (!x) return ;

	if (x < 0) putchar('-'),x = -x;

	print(x / 10);

	putchar(x % 10 + '0');

}

int main()

{

	int flag=1;

	int n;cin>>n;

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

	{

		cin>>a[i];

		if(a[i]==0)

		{

			flag=0;

		}

	}

	if(!flag)

	{

		cout<<"0";return 0;

	}

	else

	{

		int flag1=1;

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

		{

			ans*=a[i];

			if(ans>1000000000000000000LL)

			{

				flag1=0;

			}

		}

		if(!flag1)

		{

			cout<<"-1";return 0;

		}

		else

		{

			print(ans);

		}

	}

}

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



int main() {

  long long int t, sum = 1;

  scanf("%lld", &t);



  long long int n[t];

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

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

  }



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

    if(n[i] == 0) {

      printf("0");

      return 0;

    }

  }



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

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

      sum *= n[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.328466070813844x):
#include <stdio.h>



int main() {

	long long int x;

	scanf("%lld", &x);

	long long int y[x];

	long long int total=1;

	

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

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

	}

	

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

		if(y[j]==0) {

			printf("0");

			return 0;

		}

	}

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

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

			total=total*y[k];

		}



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

	scanf("%lld", &x);

	long long int y[x];

	long long int total=1;

	

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

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

	}

	

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

		if(y[j]==0) {

			printf("0");

			return 0;

		}

	}

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

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

			total=total*y[k];

		}



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

	scanf("%lld", &x);

	long long int y[x];

	long long int total=1;

	

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

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

	}

	

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

		if(y[j]==0) {

			printf("0");

			return 0;

		}

	}

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

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

			total=total*y[k];

		}



	else {

		printf("-1");

		return 0;

	}



}

	printf("%lld",total);

	return 0;

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

using namespace std;

long long x;

__int128 ans=1; 

long long a[100005];

void print(__int128 x)

{

	if (!x) return ;

	if (x < 0) putchar('-'),x = -x;

	print(x / 10);

	putchar(x % 10 + '0');

}

int main()

{

	int flag=1;

	int n;cin>>n;

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

	{

		cin>>a[i];

		if(a[i]==0)

		{

			flag=0;

		}

	}

	if(!flag)

	{

		cout<<"0";return 0;

	}

	else

	{

		int flag1=1;

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

		{

			ans*=a[i];

			if(ans>1000000000000000000LL)

			{

				flag1=0;

			}

		}

		if(!flag1)

		{

			cout<<"-1";return 0;

		}

		else

		{

			print(ans);

		}

	}

}

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



int main() {

	long long int x;

	scanf("%lld", &x);

	long long int y[x];

	long long int total=1;

	

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

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

	}

	

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

		if(y[j]==0) {

			printf("0");

			return 0;

		}

	}

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

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

			total=total*y[k];

		}



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



int main() {

  int n;

  scanf("%d", &n);

  long long int arr[n], max = 1e18, prod = 1, flag = 0, zero = 0;

  

  for (int i = 0; i < n; 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:
#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], max = 1e18, prod = 1, flag = 0, zero = 0;

  

  for (int i = 0; i < n; 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;

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], max = 1e18, prod = 1, flag = 0, zero = 0;

  

  for (int i = 0; i < n; 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;

long long x;

__int128 ans=1; 

long long a[100005];

void print(__int128 x)

{

	if (!x) return ;

	if (x < 0) putchar('-'),x = -x;

	print(x / 10);

	putchar(x % 10 + '0');

}

int main()

{

	int flag=1;

	int n;cin>>n;

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

	{

		cin>>a[i];

		if(a[i]==0)

		{

			flag=0;

		}

	}

	if(!flag)

	{

		cout<<"0";return 0;

	}

	else

	{

		int flag1=1;

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

		{

			ans*=a[i];

			if(ans>1000000000000000000LL)

			{

				flag1=0;

			}

		}

		if(!flag1)

		{

			cout<<"-1";return 0;

		}

		else

		{

			print(ans);

		}

	}

}

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



int main() {

  int n;

  scanf("%d", &n);

  long long int arr[n], max = 1e18, prod = 1, flag = 0, zero = 0;

  

  for (int i = 0; i < n; 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>

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



int main (){

	

	int a; 

	long long int ans = 1;

	scanf ("%d", &a);

	long long arr[a + 10];

	long long int batas = 1e18;

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

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

	}

	

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

		if (arr[i] == 0){

			printf ("0\n");

			return 0;

		}

	}

	

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

		if (batas/ans < arr[i]){

			printf ("-1\n");

			return 0;

		}

		ans *= arr[i];

	}

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

	

	

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



int main (){

	

	int a; 

	long long int ans = 1;

	scanf ("%d", &a);

	long long arr[a + 10];

	long long int batas = 1e18;

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

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

	}

	

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

		if (arr[i] == 0){

			printf ("0\n");

			return 0;

		}

	}

	

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

		if (batas/ans < arr[i]){

			printf ("-1\n");

			return 0;

		}

		ans *= arr[i];

	}

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

	

	

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



int main (){

	

	int a; 

	long long int ans = 1;

	scanf ("%d", &a);

	long long arr[a + 10];

	long long int batas = 1e18;

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

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

	}

	

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

		if (arr[i] == 0){

			printf ("0\n");

			return 0;

		}

	}

	

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

		if (batas/ans < arr[i]){

			printf ("-1\n");

			return 0;

		}

		ans *= arr[i];

	}

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

	

	

	return 0;

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

using namespace std;

long long x;

__int128 ans=1; 

long long a[100005];

void print(__int128 x)

{

	if (!x) return ;

	if (x < 0) putchar('-'),x = -x;

	print(x / 10);

	putchar(x % 10 + '0');

}

int main()

{

	int flag=1;

	int n;cin>>n;

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

	{

		cin>>a[i];

		if(a[i]==0)

		{

			flag=0;

		}

	}

	if(!flag)

	{

		cout<<"0";return 0;

	}

	else

	{

		int flag1=1;

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

		{

			ans*=a[i];

			if(ans>1000000000000000000LL)

			{

				flag1=0;

			}

		}

		if(!flag1)

		{

			cout<<"-1";return 0;

		}

		else

		{

			print(ans);

		}

	}

}

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



int main (){

	

	int a; 

	long long int ans = 1;

	scanf ("%d", &a);

	long long arr[a + 10];

	long long int batas = 1e18;

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

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

	}

	

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

		if (arr[i] == 0){

			printf ("0\n");

			return 0;

		}

	}

	

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

		if (batas/ans < arr[i]){

			printf ("-1\n");

			return 0;

		}

		ans *= arr[i];

	}

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

	

	

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



int main(){

	int t;

	long long a[100010];

	scanf("%d", &t);

	

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

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

		if (a[i]==0){

			printf("%d\n", 0);

			return 0;

		}

	}

	long long u=1;

	long long s=1e18;

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

			s/=a[i];

			if(s<1){

			printf("%d\n", -1);

			return 0;

			}

			else{

			u*=a[i];

			if(s>=1 && i==(t-1)) {

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

				}

			}

			}

		



	

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



int main(){

	int t;

	long long a[100010];

	scanf("%d", &t);

	

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

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

		if (a[i]==0){

			printf("%d\n", 0);

			return 0;

		}

	}

	long long u=1;

	long long s=1e18;

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

			s/=a[i];

			if(s<1){

			printf("%d\n", -1);

			return 0;

			}

			else{

			u*=a[i];

			if(s>=1 && i==(t-1)) {

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

				}

			}

			}

		



	

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



int main(){

	int t;

	long long a[100010];

	scanf("%d", &t);

	

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

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

		if (a[i]==0){

			printf("%d\n", 0);

			return 0;

		}

	}

	long long u=1;

	long long s=1e18;

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

			s/=a[i];

			if(s<1){

			printf("%d\n", -1);

			return 0;

			}

			else{

			u*=a[i];

			if(s>=1 && i==(t-1)) {

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

				}

			}

			}

		



	

	return 0;

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

using namespace std;

long long x;

__int128 ans=1; 

long long a[100005];

void print(__int128 x)

{

	if (!x) return ;

	if (x < 0) putchar('-'),x = -x;

	print(x / 10);

	putchar(x % 10 + '0');

}

int main()

{

	int flag=1;

	int n;cin>>n;

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

	{

		cin>>a[i];

		if(a[i]==0)

		{

			flag=0;

		}

	}

	if(!flag)

	{

		cout<<"0";return 0;

	}

	else

	{

		int flag1=1;

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

		{

			ans*=a[i];

			if(ans>1000000000000000000LL)

			{

				flag1=0;

			}

		}

		if(!flag1)

		{

			cout<<"-1";return 0;

		}

		else

		{

			print(ans);

		}

	}

}

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



int main(){

	int t;

	long long a[100010];

	scanf("%d", &t);

	

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

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

		if (a[i]==0){

			printf("%d\n", 0);

			return 0;

		}

	}

	long long u=1;

	long long s=1e18;

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

			s/=a[i];

			if(s<1){

			printf("%d\n", -1);

			return 0;

			}

			else{

			u*=a[i];

			if(s>=1 && i==(t-1)) {

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

				}

			}

			}

		



	

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

int main(){

  int n;

  scanf("%d", &n);

  long long int arr[n], max=1e18, prod=1, flag=0, zero=0;

  for(int i=0; i<n; 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;

}