#include <stdio.h>
#include <stdbool.h>

int main()
{
    int i, n;
    bool ovf = false;
    scanf("%d", &n);
    long long int a, b = 1, res = 0;
    while (n--) {
        scanf("%lli", &a);
        if (a == 0 || b == 0) ovf = false;
        res = a * b;
        if (a == res / b) ovf = false;
        else ovf = true;
        b = res;
    }
    if (ovf == true) res = -1;
    printf("%lli\n", res);

    return 0;
}
