stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

using namespace std;

int main(){

	long long n, a, ans=1, p, x=1000000000000000000, flag=0;

	cin>>n;

	while(n--){

		cin>>a;

		if(ans==0)

			break;

		p=x/ans;

		if(a>p){

			ans=1;

			flag=1;

		}

		else

			ans*=a;

	}

	if(ans!=0){

		if(flag)

		cout<<-1;

		else

		cout<<ans;

	}

	else

		cout<<0;

} 

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

int main()

{

    int num;

    scanf("%d", &num);

    long long int arr[num],mul = 1;

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

    {

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

        if (arr[i] == 0)

        {

            printf("0\n");

            return 0;

        }

    }

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

    {

        if (mul > 1000000000000000000/arr[i])

        {

            printf("-1\n");

            return 0;

        }

        mul *= arr[i];

    }

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

    return 0;

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

 #include<algorithm>

 #include<cmath>

 #include<iomanip>

 #include<cstring>

 #include<cmath>

 #include<map>

 #include<vector>

 #include<sstream>

 #include<queue>

using namespace std;



typedef long long ll;

const ll maxn=1e18;

int main()

{

    long long sum=1;

    int n;

    long long mid;

    cin>>n;

    int flag=0;

    while(n--)

    {

        cin>>mid;

        if(mid==0)

        {

            flag=-1;

        cout<<"0";

        return 0;

        }

        if(maxn/sum>=mid)

        sum*=mid;

        else

        flag=1;

    }

    

    if(flag==1) cout<<"-1";

    else if(flag==-1)cout<<"0";

    else cout<<sum;

    

}

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

int main()

{

    int num;

    scanf("%d", &num);

    long long int arr[num],mul = 1;

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

    {

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

        if (arr[i] == 0)

        {

            printf("0\n");

            return 0;

        }

    }

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

    {

        if (mul > 1000000000000000000/arr[i])

        {

            printf("-1\n");

            return 0;

        }

        mul *= arr[i];

    }

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

    return 0;

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

using namespace std;

int main()

{

    long long int n,s=1;

    double ans=0;

    cin>>n;

    long long int a[n],c=1,i;

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

        cin>>a[i];

        if(a[i]==0)

            c=0;

        //cout<<log10(a[i])<<endl;

        ans=ans+(log10(a[i]));

        //cout<<ans<<endl;

    }

    if(c==0)

        cout<<"0"<<endl;

    else if(ans<=18){

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

            s=s*a[i];

        if(s<=1000000000000000000)

        cout<<s<<endl;

        else

            cout<<"-1"<<endl;

    }

    else

        cout<<"-1"<<endl;

    return 0;

}




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

int main()

{

    int num;

    scanf("%d", &num);

    long long int arr[num],mul = 1;

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

    {

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

        if (arr[i] == 0)

        {

            printf("0\n");

            return 0;

        }

    }

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

    {

        if (mul > 1000000000000000000/arr[i])

        {

            printf("-1\n");

            return 0;

        }

        mul *= arr[i];

    }

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

    return 0;

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

using namespace std;

typedef long long ll;

ll wq[100003];

int main()

{

    int g,t;

    ll re=1,lm=1e18;

    scanf("%d",&t);

    for(g=0;g<t;g++)

        scanf("%lld",&wq[g]);

    for(g=0;g<t;g++)if(!wq[g]){

        printf("0\n");

        return 0;

    }

    for(g=0;g<t;g++){

        if(wq[g]<=(lm/re))

            re*=wq[g];

        else{

            printf("-1\n");

            return 0;

        }

    }

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

    return 0;

}


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

int main()

{

    int num;

    scanf("%d", &num);

    long long int arr[num],mul = 1;

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

    {

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

        if (arr[i] == 0)

        {

            printf("0\n");

            return 0;

        }

    }

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

    {

        if (mul > 1000000000000000000/arr[i])

        {

            printf("-1\n");

            return 0;

        }

        mul *= arr[i];

    }

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

    return 0;

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

using namespace std;

#define c 1000000000000000000

#define ll long long int

int main()

{

    ll n,i,count=1,flag=0;

    cin>>n;

    ll a[n+1];

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

    {

        cin>>a[i];

        if(a[i]==0)

            flag=1;

    }

    ll sum=a[0];

    if(flag==0) {

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

            if (a[i] <= c / sum) {

                sum=sum*a[i];

                count++;

            } else

            {

                cout<<"-1"<<endl;

                break;

            }

        }

        if(count==n)

            cout<<sum<<endl;

    }

    else

        cout<<"0"<<endl;

    return 0;

}

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

int main()

{

    int num;

    scanf("%d", &num);

    long long int arr[num],mul = 1;

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

    {

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

        if (arr[i] == 0)

        {

            printf("0\n");

            return 0;

        }

    }

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

    {

        if (mul > 1000000000000000000/arr[i])

        {

            printf("-1\n");

            return 0;

        }

        mul *= arr[i];

    }

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

    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 <= 1000000000000000000/ans ? ans *= a : flag = 1;

    }

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

	return 0;

}


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

int main()

{

    int num;

    scanf("%d", &num);

    long long int arr[num],mul = 1;

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

    {

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

        if (arr[i] == 0)

        {

            printf("0\n");

            return 0;

        }

    }

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

    {

        if (mul > 1000000000000000000/arr[i])

        {

            printf("-1\n");

            return 0;

        }

        mul *= arr[i];

    }

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

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

#define N 100001

typedef long long LL;



LL a[N];



LL read()

{

	char c;

	while((c = getchar()) < 48 || c > 57);

	LL x = c - 48;

	while((c = getchar()) > 47 && c < 58) x = x * 10 + c - 48;

	return x;

}



int main()

{		

	int n, i;

	LL m = 1000000000000000000, ans = 1;

		

	scanf("%d", &n);

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

		if(!(a[i] = read())) ans = 0;

	}

	if(!ans) puts("0");

	else{

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

			m /= a[i];

			if(!m){

				ans = -1;

				break;

			}

			ans *= a[i];

		}

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

	}

		

			

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

#define N 100001

typedef long long LL;



LL a[N];



LL read()

{

	char c;

	while((c = getchar()) < 48 || c > 57);

	LL x = c - 48;

	while((c = getchar()) > 47 && c < 58) x = x * 10 + c - 48;

	return x;

}



int main()

{		

	int n, i;

	LL m = 1000000000000000000, ans = 1;

		

	scanf("%d", &n);

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

		if(!(a[i] = read())) ans = 0;

	}

	if(!ans) puts("0");

	else{

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

			m /= a[i];

			if(!m){

				ans = -1;

				break;

			}

			ans *= a[i];

		}

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

	}

		

			

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

#define N 100001

typedef long long LL;



LL a[N];



LL read()

{

	char c;

	while((c = getchar()) < 48 || c > 57);

	LL x = c - 48;

	while((c = getchar()) > 47 && c < 58) x = x * 10 + c - 48;

	return x;

}



int main()

{		

	int n, i;

	LL m = 1000000000000000000, ans = 1;

		

	scanf("%d", &n);

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

		if(!(a[i] = read())) ans = 0;

	}

	if(!ans) puts("0");

	else{

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

			m /= a[i];

			if(!m){

				ans = -1;

				break;

			}

			ans *= a[i];

		}

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

	}

		

			

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

#define N 100001

typedef long long LL;



LL a[N];



LL read()

{

	char c;

	while((c = getchar()) < 48 || c > 57);

	LL x = c - 48;

	while((c = getchar()) > 47 && c < 58) x = x * 10 + c - 48;

	return x;

}



int main()

{		

	int n, i;

	LL m = 1000000000000000000, ans = 1;

		

	scanf("%d", &n);

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

		if(!(a[i] = read())) ans = 0;

	}

	if(!ans) puts("0");

	else{

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

			m /= a[i];

			if(!m){

				ans = -1;

				break;

			}

			ans *= a[i];

		}

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

	}

		

			

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

#define N 100001

typedef long long LL;



LL a[N];



LL read()

{

	char c;

	while((c = getchar()) < 48 || c > 57);

	LL x = c - 48;

	while((c = getchar()) > 47 && c < 58) x = x * 10 + c - 48;

	return x;

}



int main()

{		

	int n, i;

	LL m = 1000000000000000000, ans = 1;

		

	scanf("%d", &n);

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

		if(!(a[i] = read())) ans = 0;

	}

	if(!ans) puts("0");

	else{

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

			m /= a[i];

			if(!m){

				ans = -1;

				break;

			}

			ans *= a[i];

		}

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

	}

		

			

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

#define N 100001

typedef long long LL;



LL a[N];



LL read()

{

	char c;

	while((c = getchar()) < 48 || c > 57);

	LL x = c - 48;

	while((c = getchar()) > 47 && c < 58) x = x * 10 + c - 48;

	return x;

}



int main()

{		

	int n, i;

	LL m = 1000000000000000000, ans = 1;

		

	scanf("%d", &n);

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

		if(!(a[i] = read())) ans = 0;

	}

	if(!ans) puts("0");

	else{

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

			m /= a[i];

			if(!m){

				ans = -1;

				break;

			}

			ans *= a[i];

		}

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

	}

		

			

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

int main(){

	//soal F

	long long int N; //test case

	long long int g = 1; //buat hasil perkalian

	scanf("%lld", &N);

	long long int h[N]={}; //array buat menampung angka



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

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

		} 

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

			if (h[j] == 0){

	 			printf("0");

 				return 0;

			}

		}

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

 			if (h[k] <= 1000000000000000000/g){

 			g *= h[k];

		} else {

			printf("-1");

			return 0;

		}

	}	

		printf("%lld",g);

	return 0;

}

/*

cek inputan sekarang dia > 10^18

inputan ->10^18 / total



long long tc;

long long hasil = 1;

scanf("%lld", &n);



long long input[tc];

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

scanf("%lld", input)

}



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

 if (input[i] == 0){

 		printf("0");

 		return 0;

}

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

 if (input[i] > 1000000/hasil){

 		hasil *= input[i]

} else {

	}



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

int main(){

	//soal F

	long long int N; //test case

	long long int g = 1; //buat hasil perkalian

	scanf("%lld", &N);

	long long int h[N]={}; //array buat menampung angka



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

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

		} 

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

			if (h[j] == 0){

	 			printf("0");

 				return 0;

			}

		}

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

 			if (h[k] <= 1000000000000000000/g){

 			g *= h[k];

		} else {

			printf("-1");

			return 0;

		}

	}	

		printf("%lld",g);

	return 0;

}

/*

cek inputan sekarang dia > 10^18

inputan ->10^18 / total



long long tc;

long long hasil = 1;

scanf("%lld", &n);



long long input[tc];

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

scanf("%lld", input)

}



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

 if (input[i] == 0){

 		printf("0");

 		return 0;

}

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

 if (input[i] > 1000000/hasil){

 		hasil *= input[i]

} else {

	}



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

int main(){

	//soal F

	long long int N; //test case

	long long int g = 1; //buat hasil perkalian

	scanf("%lld", &N);

	long long int h[N]={}; //array buat menampung angka



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

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

		} 

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

			if (h[j] == 0){

	 			printf("0");

 				return 0;

			}

		}

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

 			if (h[k] <= 1000000000000000000/g){

 			g *= h[k];

		} else {

			printf("-1");

			return 0;

		}

	}	

		printf("%lld",g);

	return 0;

}

/*

cek inputan sekarang dia > 10^18

inputan ->10^18 / total



long long tc;

long long hasil = 1;

scanf("%lld", &n);



long long input[tc];

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

scanf("%lld", input)

}



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

 if (input[i] == 0){

 		printf("0");

 		return 0;

}

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

 if (input[i] > 1000000/hasil){

 		hasil *= input[i]

} else {

	}



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

int main(){

	//soal F

	long long int N; //test case

	long long int g = 1; //buat hasil perkalian

	scanf("%lld", &N);

	long long int h[N]={}; //array buat menampung angka



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

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

		} 

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

			if (h[j] == 0){

	 			printf("0");

 				return 0;

			}

		}

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

 			if (h[k] <= 1000000000000000000/g){

 			g *= h[k];

		} else {

			printf("-1");

			return 0;

		}

	}	

		printf("%lld",g);

	return 0;

}

/*

cek inputan sekarang dia > 10^18

inputan ->10^18 / total



long long tc;

long long hasil = 1;

scanf("%lld", &n);



long long input[tc];

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

scanf("%lld", input)

}



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

 if (input[i] == 0){

 		printf("0");

 		return 0;

}

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

 if (input[i] > 1000000/hasil){

 		hasil *= input[i]

} else {

	}



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

int main(){

	//soal F

	long long int N; //test case

	long long int g = 1; //buat hasil perkalian

	scanf("%lld", &N);

	long long int h[N]={}; //array buat menampung angka



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

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

		} 

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

			if (h[j] == 0){

	 			printf("0");

 				return 0;

			}

		}

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

 			if (h[k] <= 1000000000000000000/g){

 			g *= h[k];

		} else {

			printf("-1");

			return 0;

		}

	}	

		printf("%lld",g);

	return 0;

}

/*

cek inputan sekarang dia > 10^18

inputan ->10^18 / total



long long tc;

long long hasil = 1;

scanf("%lld", &n);



long long input[tc];

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

scanf("%lld", input)

}



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

 if (input[i] == 0){

 		printf("0");

 		return 0;

}

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

 if (input[i] > 1000000/hasil){

 		hasil *= input[i]

} else {

	}



*/