"use strict";

const main = arg => {
    const inputList = arg.trim().split("\n");
    // 回答を記述
    const N = BigInt(inputList[0].split(" ")[0]);
    const AList = inputList[1].split(" ");

    const num = AList.reduce((acc, cul) => BigInt(cul) * BigInt(acc), 1);

    if (num > 10n ** 18n) {
        console.log(-1);
    } else {
        console.log(BigInt.asIntN(64, num).toString());
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));