process.stdin.resume();
process.stdin.setEncoding('utf8');

let inputData = '';

process.stdin.on('data', inputStdin => {
  inputData += inputStdin;
});

process.stdin.on('end', _ => {
  // data parse
  inputData = inputData.replace(/\s*$/g, '')
    .split('\n')
    .map(str => str.split(' '));
  main();
});

function main() {
  const limit = 10n ** 18n;
  let result = inputData[1].reduce((a, b) => BigInt(a) * BigInt(b));

  if (result > limit) {
    result = -1;
  }

  process.stdout.write(result.toString());
}
