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



int main() {



long long int n;

long long int t;

scanf("%lld", &t);



long long int num[t];

long long int sum = 1;



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

	scanf("%lld", &n);

	num[i] = n;

}



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

	if(num[i]==0){

		printf("0\n");

		return 0;

	}

}



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

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

	sum *= num[i];

	}

	else{ 

	printf("-1\n");

	return 0;

	}	

}



printf("%lld\n", 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.2947181792553755x):
#include <stdio.h>



int main() {



long long int n;

long long int t;

scanf("%lld", &t);



long long int num[t];

long long int sum = 1;



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

	scanf("%lld", &n);

	num[i] = n;

}



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

	if(num[i]==0){

		printf("0\n");

		return 0;

	}

}



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

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

	sum *= num[i];

	}

	else{ 

	printf("-1\n");

	return 0;

	}	

}



printf("%lld\n", 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.167122640054307x):
#include <stdio.h>



int main() {



long long int n;

long long int t;

scanf("%lld", &t);



long long int num[t];

long long int sum = 1;



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

	scanf("%lld", &n);

	num[i] = n;

}



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

	if(num[i]==0){

		printf("0\n");

		return 0;

	}

}



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

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

	sum *= num[i];

	}

	else{ 

	printf("-1\n");

	return 0;

	}	

}



printf("%lld\n", 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.309586389274195x):
#include <stdio.h>



int main() {

	int N;

	scanf("%d", &N);

	

	long long int A1[N];

	long long int A2 = 1;

	long long int max = 1000000000000000000;

	

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

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

	}

	

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

		if(A1[j] == 0){

			printf("0\n");

			return 0;

		}

	}

	

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

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

			A2 *= A1[k];

		} else{

			printf("-1\n");

			return 0;

		}

	}

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

	

	return 0;

}
// Slower C++ solution:
#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.285371871147785x):
#include <stdio.h>



int main() {

	int N;

	scanf("%d", &N);

	

	long long int A1[N];

	long long int A2 = 1;

	long long int max = 1000000000000000000;

	

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

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

	}

	

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

		if(A1[j] == 0){

			printf("0\n");

			return 0;

		}

	}

	

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

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

			A2 *= A1[k];

		} else{

			printf("-1\n");

			return 0;

		}

	}

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

	

	return 0;

}
// Slower C++ solution:
#include <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.158001565317437x):
#include <stdio.h>



int main() {

	int N;

	scanf("%d", &N);

	

	long long int A1[N];

	long long int A2 = 1;

	long long int max = 1000000000000000000;

	

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

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

	}

	

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

		if(A1[j] == 0){

			printf("0\n");

			return 0;

		}

	}

	

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

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

			A2 *= A1[k];

		} else{

			printf("-1\n");

			return 0;

		}

	}

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

	

	return 0;

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

using namespace std;

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



int main(){



    long long int testcase;

    long long int total = 1;

    long long int A[100005]; //A untuk angka

    bool lanjut = true;

    bool printtotal = true;

    scanf("%lld", &testcase);

   

    

    for (long long int i = 1; i <= testcase; i++){ //kalau ada 0 auto

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

        if(A[i]==0){

            printf("0\n");

            lanjut = false;

            break;

        }

    }

    

      if(lanjut){

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

              if(1000000000000000000/total >= A[i]){

                  total *= A[i];

            }

            else{

                printf("-1\n"); //kelebihan dari 10^18

                printtotal = false;

                break;

            }    

        }    

        if(printtotal){   //kalau tidak print

            printf("%lld\n",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: 4.9085095468316515x):
#include <stdio.h>



int main(){



    long long int testcase;

    long long int total = 1;

    long long int A[100005]; //A untuk angka

    bool lanjut = true;

    bool printtotal = true;

    scanf("%lld", &testcase);

   

    

    for (long long int i = 1; i <= testcase; i++){ //kalau ada 0 auto

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

        if(A[i]==0){

            printf("0\n");

            lanjut = false;

            break;

        }

    }

    

      if(lanjut){

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

              if(1000000000000000000/total >= A[i]){

                  total *= A[i];

            }

            else{

                printf("-1\n"); //kelebihan dari 10^18

                printtotal = false;

                break;

            }    

        }    

        if(printtotal){   //kalau tidak print

            printf("%lld\n",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: 4.7902211127549466x):
#include <stdio.h>



int main(){



    long long int testcase;

    long long int total = 1;

    long long int A[100005]; //A untuk angka

    bool lanjut = true;

    bool printtotal = true;

    scanf("%lld", &testcase);

   

    

    for (long long int i = 1; i <= testcase; i++){ //kalau ada 0 auto

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

        if(A[i]==0){

            printf("0\n");

            lanjut = false;

            break;

        }

    }

    

      if(lanjut){

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

              if(1000000000000000000/total >= A[i]){

                  total *= A[i];

            }

            else{

                printf("-1\n"); //kelebihan dari 10^18

                printtotal = false;

                break;

            }    

        }    

        if(printtotal){   //kalau tidak print

            printf("%lld\n",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 <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.330923598452321x):
#include <stdio.h>



int main() {

	long long int test, result = 1;

	scanf("%lld", &test);

	long long x[test];

	

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

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

	}

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

		if(x[i] == 0) {

			printf("0");

			return 0;

		}

	}

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

		if(x[i] <= (1000000000000000000 / result)){

			result *= x[i];

		} else {

			result = -1;

			break;

		}

	}

	printf("%lld", result);

	

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



int main() {

	long long int test, result = 1;

	scanf("%lld", &test);

	long long x[test];

	

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

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

	}

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

		if(x[i] == 0) {

			printf("0");

			return 0;

		}

	}

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

		if(x[i] <= (1000000000000000000 / result)){

			result *= x[i];

		} else {

			result = -1;

			break;

		}

	}

	printf("%lld", result);

	

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



int main() {

	long long int test, result = 1;

	scanf("%lld", &test);

	long long x[test];

	

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

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

	}

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

		if(x[i] == 0) {

			printf("0");

			return 0;

		}

	}

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

		if(x[i] <= (1000000000000000000 / result)){

			result *= x[i];

		} else {

			result = -1;

			break;

		}

	}

	printf("%lld", result);

	

	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 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:
#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 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;

}