#include <stdio.h>

int main()
{
    int n;
    long long a[100001], mul = 1;

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%lld", &a[i]);

    for (int i = 0; i < n; i++)
    {
        mul *= a[i];
    }

    if (mul / a[n-1] != a[n - 2])
        mul = -1;

    printf("%lld", mul);
}