stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
 #include<bits/stdc++.h>

#include<iostream>

#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

#define ll  long long

#define ull unsigned long long

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

#define endl '\n'

#define main() int main()

#define ff1(i,n) for(int i=1;i<=n;++i)

#define ff0(i,n) for(int i=0;i<n;++i)

#define pi acos(-1.0)

#define ms(a, x) memset(a, x, sizeof(a))

#define lowbit(x) ((x)&(-(x)))

#define pb push_back

#define binarycount __builtin_popcount(x)

#define tr t[root]

#define lson t[root << 1]

#define rson t[root << 1 | 1]

#define fir first

#define sec second

#define debug(x) cout<<x<<'\n'

#define sa(a) scanf("%d", &a)

#define sab(a, b) scanf("%d%d", &a, &b)

#define pa(a) printf("%d",a)

#define pab(a,b) printf("%d%d",a,b)

#define pii pair<int,int>

using namespace std;



#define maxn 200005

const int inf = 0x3f3f3f3f;

const int mod = 1e9+7;

const double eps = 1e-8;

ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}

ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}

ll powmod(ll a,ll b){

    ll ans = 1, pow = a%mod;

    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }

    return ans%mod;

}

ull a[maxn];

const ll maxx=1e18;

bool judge(ull a, ull b) {

    if (maxx/a<b) {

        return true;

    }

    return false;

}

main() {

    int n;

    cin>>n;

    int f=1;

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

        cin>>a[i];

        if (a[i]==0) f=0;

    }

    if(f==0){

    	cout<<0<<endl;

    	return 0;

	}

    ll ans=1;

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

        if (judge(ans,a[i])) {

            cout<<"-1"<<endl;

            return 0;

        }

        ans*=a[i];

    }

    cout<<ans<<endl;





}

 

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



int main(){

	int n;

	scanf("%d", &n);

	long long int total=1, batas=1e18;

	int zero=0, flag=0;

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

		long long int angka;

		scanf("%lld", &angka);

		if(angka==0){

			zero=1;

			break;

		}

		else{

			flag=(batas<angka) ? flag=1 :flag=0;

			total*=angka;

			batas/=angka;

		}

	}

	if(zero==1){

		printf("0\n");

	}

	else{

		if(flag==1){

			printf("-1\n");

		}

		else printf("%lld\n", total);

	}

	return 0;

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

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

using namespace std;

typedef long long ll;

const int maxn = 1e5 + 5;

const ll inf = 1e18;

int main() {

    IO;

    int n;

    ll ans = 1;

    cin >> n;

    bool flag = true;

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

        ll x;

        cin >> x;

        if (x == 0) {

            ans = 0;

            flag = true;

        }

        else if (ULLONG_MAX / ans < x || x * ans > inf) {

            flag = false;

            //cout << ans << " " << ULLONG_MAX << " " << ULLONG_MAX / ans << endl;

        }

        if (flag) ans *= x;

        // cout << ans << endl;

    }

    if (flag)

        cout << ans << endl;

    else {

        cout << -1 << endl;

    }



    return 0;

}

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



int main(){

	int n;

	scanf("%d", &n);

	long long int total=1, batas=1e18;

	int zero=0, flag=0;

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

		long long int angka;

		scanf("%lld", &angka);

		if(angka==0){

			zero=1;

			break;

		}

		else{

			flag=(batas<angka) ? flag=1 :flag=0;

			total*=angka;

			batas/=angka;

		}

	}

	if(zero==1){

		printf("0\n");

	}

	else{

		if(flag==1){

			printf("-1\n");

		}

		else printf("%lld\n", total);

	}

	return 0;

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

using namespace std;

long long int n,a,b,f;

vector<long long int>v;

int main()

{

    cin>>n;

    b=1,f=0;

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

    {

        cin>>a;

        if(a==0)

            f=1;

        v.push_back(a);

    }

    if(f)

        return cout<<0<<endl,0;

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

    {

        if(b / 1e18 * v[i] <= 1.00)

            b*=v[i];

        else

            return cout<<-1<<endl,0;

    }



    if (b <= 1000000000000000000LL)

        cout<<b;

    else

        cout << -1;

    return 0;

}

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



int main(){

	int n;

	scanf("%d", &n);

	long long int total=1, batas=1e18;

	int zero=0, flag=0;

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

		long long int angka;

		scanf("%lld", &angka);

		if(angka==0){

			zero=1;

			break;

		}

		else{

			flag=(batas<angka) ? flag=1 :flag=0;

			total*=angka;

			batas/=angka;

		}

	}

	if(zero==1){

		printf("0\n");

	}

	else{

		if(flag==1){

			printf("-1\n");

		}

		else printf("%lld\n", total);

	}

	return 0;

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

using namespace std;



bool overflow(long long a, long long b)

{

    if (a <= (1000000000000000000 / b)) return 0;

    return 1;

}



int main()

{

    long long n;

    cin >> n;

    vector<long long> v(n);

    bool f = 1;

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

        cin >> v[i];

        if (v[i] == 0) f = 0;

    }

    if (f == 0){

        cout << 0 << endl;

        return 0;

    }

    f = 0;

    long long mul = 1LL;

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

        if (overflow(mul, v[i])){

            f = 1;

            break;

        }

        mul *= v[i];

    }

    if (overflow(mul, 1LL)) f = 1;

    if (f) puts("-1");

    else cout << mul << endl;

}

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



int main(){

	int n;

	scanf("%d", &n);

	long long int total=1, batas=1e18;

	int zero=0, flag=0;

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

		long long int angka;

		scanf("%lld", &angka);

		if(angka==0){

			zero=1;

			break;

		}

		else{

			flag=(batas<angka) ? flag=1 :flag=0;

			total*=angka;

			batas/=angka;

		}

	}

	if(zero==1){

		printf("0\n");

	}

	else{

		if(flag==1){

			printf("-1\n");

		}

		else printf("%lld\n", total);

	}

	return 0;

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



int main(){



    int i;

    int brpkali;

    long long hasil=1;

    unsigned long long Data = 1000000000000000000u;

    scanf("%d", &brpkali);

    long long arr[1000000]={};

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

    {

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

    }

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

    {

    

        if (arr[i]==0){

            printf("0\n");

            return 0;

        }

    }

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

    {

        if (arr[i]<=(Data/hasil))

        {   

            hasil*=arr[i];

            

        }

        else

        {

            printf("-1\n");

            return 0;

        }  

    }

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



    return 0;

}

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



int main(){

	int n;

	scanf("%d", &n);

	long long int total=1, batas=1e18;

	int zero=0, flag=0;

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

		long long int angka;

		scanf("%lld", &angka);

		if(angka==0){

			zero=1;

			break;

		}

		else{

			flag=(batas<angka) ? flag=1 :flag=0;

			total*=angka;

			batas/=angka;

		}

	}

	if(zero==1){

		printf("0\n");

	}

	else{

		if(flag==1){

			printf("-1\n");

		}

		else printf("%lld\n", total);

	}

	return 0;

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



int main(){



    int i;

    int brpkali;

    long long hasil=1;

    unsigned long long Data = 1000000000000000000u;

    scanf("%d", &brpkali);

    long long arr[1000000]={};

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

    {

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

    }

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

    {

    

        if (arr[i]==0){

            printf("0\n");

            return 0;

        }

    }

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

    {

        if (arr[i]<=(Data/hasil))

        {   

            hasil*=arr[i];

            

        }

        else

        {

            printf("-1\n");

            return 0;

        }  

    }

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



    return 0;

}

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

using namespace std;



int n;

long long ans=1;

bool zero=false, minuss=false;



int main(){

	cin >> n;

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

		long long a;

		cin >> a;

		if (a==0) zero=true;

		else if (ans<=1000000000000000000/a) ans*=a;

		else minuss=true;

	}

	if (zero) cout << 0 << "\n";

	else if (minuss) cout << -1 << "\n";

	else cout << ans << "\n";

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

using namespace std;

int main()

{

	long long n;

	cin>>n;

	long long a[n];

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

	cin>>a[i];

	long long sum=1,jilu=0;

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

	{

		if(a[i]==0)

		jilu=1;

	}

	if(jilu==1)

	cout<<0;

	else

	{

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

	{

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

		{

			sum=-1;

			break;

		}

	sum*=a[i];

	}

	cout<<sum;

		}

} 

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

 

int main(){

  long long n,ans=1;

  scanf("%lld",&n);

  long long arr[n+5],maks=1000000000000000000;

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

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

  

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

    if(arr[i]==0){

        printf("0");

        return 0;

    }

  }

  

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

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

        printf("-1");

        return 0;

    }

    

    ans*=arr[i];

  }

  

  printf("%lld",ans);

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

#include<iostream>

#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

#define ll  long long

#define ull unsigned long long

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

#define endl '\n'

#define main() int main()

#define ff1(i,n) for(int i=1;i<=n;++i)

#define ff0(i,n) for(int i=0;i<n;++i)

#define pi acos(-1.0)

#define ms(a, x) memset(a, x, sizeof(a))

#define lowbit(x) ((x)&(-(x)))

#define pb push_back

#define binarycount __builtin_popcount(x)

#define tr t[root]

#define lson t[root << 1]

#define rson t[root << 1 | 1]

#define fir first

#define sec second

#define debug(x) cout<<x<<'\n'

#define sa(a) scanf("%d", &a)

#define sab(a, b) scanf("%d%d", &a, &b)

#define pa(a) printf("%d",a)

#define pab(a,b) printf("%d%d",a,b)

#define pii pair<int,int>

using namespace std;



#define maxn 200005

const int inf = 0x3f3f3f3f;

const int mod = 1e9+7;

const double eps = 1e-8;

ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}

ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}

ll powmod(ll a,ll b){

    ll ans = 1, pow = a%mod;

    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }

    return ans%mod;

}

ull a[maxn];

const ll maxx=1e18;

bool judge(ull a, ull b) {

    if (maxx/a<b) {

        return true;

    }

    return false;

}

main() {

    int n;

    cin>>n;

    int f=1;

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

        cin>>a[i];

        if (a[i]==0) f=0;

    }

    if(f==0){

    	cout<<0<<endl;

    	return 0;

	}

    ll ans=1;

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

        if (judge(ans,a[i])) {

            cout<<"-1"<<endl;

            return 0;

        }

        ans*=a[i];

    }

    cout<<ans<<endl;





}

 

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

 

int main(){

  long long n,ans=1;

  scanf("%lld",&n);

  long long arr[n+5],maks=1000000000000000000;

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

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

  

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

    if(arr[i]==0){

        printf("0");

        return 0;

    }

  }

  

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

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

        printf("-1");

        return 0;

    }

    

    ans*=arr[i];

  }

  

  printf("%lld",ans);

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

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

using namespace std;

typedef long long ll;

const int maxn = 1e5 + 5;

const ll inf = 1e18;

int main() {

    IO;

    int n;

    ll ans = 1;

    cin >> n;

    bool flag = true;

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

        ll x;

        cin >> x;

        if (x == 0) {

            ans = 0;

            flag = true;

        }

        else if (ULLONG_MAX / ans < x || x * ans > inf) {

            flag = false;

            //cout << ans << " " << ULLONG_MAX << " " << ULLONG_MAX / ans << endl;

        }

        if (flag) ans *= x;

        // cout << ans << endl;

    }

    if (flag)

        cout << ans << endl;

    else {

        cout << -1 << endl;

    }



    return 0;

}

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

 

int main(){

  long long n,ans=1;

  scanf("%lld",&n);

  long long arr[n+5],maks=1000000000000000000;

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

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

  

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

    if(arr[i]==0){

        printf("0");

        return 0;

    }

  }

  

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

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

        printf("-1");

        return 0;

    }

    

    ans*=arr[i];

  }

  

  printf("%lld",ans);

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

using namespace std;

long long int n,a,b,f;

vector<long long int>v;

int main()

{

    cin>>n;

    b=1,f=0;

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

    {

        cin>>a;

        if(a==0)

            f=1;

        v.push_back(a);

    }

    if(f)

        return cout<<0<<endl,0;

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

    {

        if(b / 1e18 * v[i] <= 1.00)

            b*=v[i];

        else

            return cout<<-1<<endl,0;

    }



    if (b <= 1000000000000000000LL)

        cout<<b;

    else

        cout << -1;

    return 0;

}

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

 

int main(){

  long long n,ans=1;

  scanf("%lld",&n);

  long long arr[n+5],maks=1000000000000000000;

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

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

  

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

    if(arr[i]==0){

        printf("0");

        return 0;

    }

  }

  

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

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

        printf("-1");

        return 0;

    }

    

    ans*=arr[i];

  }

  

  printf("%lld",ans);

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

using namespace std;



bool overflow(long long a, long long b)

{

    if (a <= (1000000000000000000 / b)) return 0;

    return 1;

}



int main()

{

    long long n;

    cin >> n;

    vector<long long> v(n);

    bool f = 1;

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

        cin >> v[i];

        if (v[i] == 0) f = 0;

    }

    if (f == 0){

        cout << 0 << endl;

        return 0;

    }

    f = 0;

    long long mul = 1LL;

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

        if (overflow(mul, v[i])){

            f = 1;

            break;

        }

        mul *= v[i];

    }

    if (overflow(mul, 1LL)) f = 1;

    if (f) puts("-1");

    else cout << mul << endl;

}

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

 

int main(){

  long long n,ans=1;

  scanf("%lld",&n);

  long long arr[n+5],maks=1000000000000000000;

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

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

  

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

    if(arr[i]==0){

        printf("0");

        return 0;

    }

  }

  

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

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

        printf("-1");

        return 0;

    }

    

    ans*=arr[i];

  }

  

  printf("%lld",ans);

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



int main(){



    int i;

    int brpkali;

    long long hasil=1;

    unsigned long long Data = 1000000000000000000u;

    scanf("%d", &brpkali);

    long long arr[1000000]={};

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

    {

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

    }

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

    {

    

        if (arr[i]==0){

            printf("0\n");

            return 0;

        }

    }

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

    {

        if (arr[i]<=(Data/hasil))

        {   

            hasil*=arr[i];

            

        }

        else

        {

            printf("-1\n");

            return 0;

        }  

    }

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



    return 0;

}

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

 

int main(){

  long long n,ans=1;

  scanf("%lld",&n);

  long long arr[n+5],maks=1000000000000000000;

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

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

  

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

    if(arr[i]==0){

        printf("0");

        return 0;

    }

  }

  

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

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

        printf("-1");

        return 0;

    }

    

    ans*=arr[i];

  }

  

  printf("%lld",ans);

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

using namespace std;



int n;

long long ans=1;

bool zero=false, minuss=false;



int main(){

	cin >> n;

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

		long long a;

		cin >> a;

		if (a==0) zero=true;

		else if (ans<=1000000000000000000/a) ans*=a;

		else minuss=true;

	}

	if (zero) cout << 0 << "\n";

	else if (minuss) cout << -1 << "\n";

	else cout << ans << "\n";

}

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

 

int main(){

  long long n,ans=1;

  scanf("%lld",&n);

  long long arr[n+5],maks=1000000000000000000;

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

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

  

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

    if(arr[i]==0){

        printf("0");

        return 0;

    }

  }

  

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

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

        printf("-1");

        return 0;

    }

    

    ans*=arr[i];

  }

  

  printf("%lld",ans);

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

using namespace std;

int main()

{

	long long n;

	cin>>n;

	long long a[n];

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

	cin>>a[i];

	long long sum=1,jilu=0;

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

	{

		if(a[i]==0)

		jilu=1;

	}

	if(jilu==1)

	cout<<0;

	else

	{

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

	{

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

		{

			sum=-1;

			break;

		}

	sum*=a[i];

	}

	cout<<sum;

		}

} 

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



int main (){

	

	long long int a; 

	long long int ans = 1;

	scanf ("%lld", &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>

#include<iostream>

#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

#define ll  long long

#define ull unsigned long long

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

#define endl '\n'

#define main() int main()

#define ff1(i,n) for(int i=1;i<=n;++i)

#define ff0(i,n) for(int i=0;i<n;++i)

#define pi acos(-1.0)

#define ms(a, x) memset(a, x, sizeof(a))

#define lowbit(x) ((x)&(-(x)))

#define pb push_back

#define binarycount __builtin_popcount(x)

#define tr t[root]

#define lson t[root << 1]

#define rson t[root << 1 | 1]

#define fir first

#define sec second

#define debug(x) cout<<x<<'\n'

#define sa(a) scanf("%d", &a)

#define sab(a, b) scanf("%d%d", &a, &b)

#define pa(a) printf("%d",a)

#define pab(a,b) printf("%d%d",a,b)

#define pii pair<int,int>

using namespace std;



#define maxn 200005

const int inf = 0x3f3f3f3f;

const int mod = 1e9+7;

const double eps = 1e-8;

ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}

ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}

ll powmod(ll a,ll b){

    ll ans = 1, pow = a%mod;

    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }

    return ans%mod;

}

ull a[maxn];

const ll maxx=1e18;

bool judge(ull a, ull b) {

    if (maxx/a<b) {

        return true;

    }

    return false;

}

main() {

    int n;

    cin>>n;

    int f=1;

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

        cin>>a[i];

        if (a[i]==0) f=0;

    }

    if(f==0){

    	cout<<0<<endl;

    	return 0;

	}

    ll ans=1;

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

        if (judge(ans,a[i])) {

            cout<<"-1"<<endl;

            return 0;

        }

        ans*=a[i];

    }

    cout<<ans<<endl;





}

 

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



int main (){

	

	long long int a; 

	long long int ans = 1;

	scanf ("%lld", &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>

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

using namespace std;

typedef long long ll;

const int maxn = 1e5 + 5;

const ll inf = 1e18;

int main() {

    IO;

    int n;

    ll ans = 1;

    cin >> n;

    bool flag = true;

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

        ll x;

        cin >> x;

        if (x == 0) {

            ans = 0;

            flag = true;

        }

        else if (ULLONG_MAX / ans < x || x * ans > inf) {

            flag = false;

            //cout << ans << " " << ULLONG_MAX << " " << ULLONG_MAX / ans << endl;

        }

        if (flag) ans *= x;

        // cout << ans << endl;

    }

    if (flag)

        cout << ans << endl;

    else {

        cout << -1 << endl;

    }



    return 0;

}

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



int main (){

	

	long long int a; 

	long long int ans = 1;

	scanf ("%lld", &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 int n,a,b,f;

vector<long long int>v;

int main()

{

    cin>>n;

    b=1,f=0;

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

    {

        cin>>a;

        if(a==0)

            f=1;

        v.push_back(a);

    }

    if(f)

        return cout<<0<<endl,0;

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

    {

        if(b / 1e18 * v[i] <= 1.00)

            b*=v[i];

        else

            return cout<<-1<<endl,0;

    }



    if (b <= 1000000000000000000LL)

        cout<<b;

    else

        cout << -1;

    return 0;

}

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



int main (){

	

	long long int a; 

	long long int ans = 1;

	scanf ("%lld", &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;

}