#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    int N;
    long long int *A;
    long long int ans = 1;
    long long int ans2;
    int c;
    char temp[20];
    char temp2[20];
    scanf("%d", &N);
    A = (long long int *)malloc(sizeof(long long int) * N);
    for (c = 0; c < N; ++c)
    {
        scanf("%lld", A + c);
        if (A[c] == 0)
        {
            printf("0");
            return 0;
        }
    }
    for (c = 0; c < N; ++c)
    {
        ans2 = ans;
        ans *= A[c];
        if (ans > (long long)1e+18 || ans / A[c] != ans2)
        {
            printf("-1");
            return 0;
        }
    }
    printf("%lld", ans);
    return 0;
}