function main(lines) {
  const input = lines.split('\n').slice(1).join(' ').split(' ').map(Number)
  const multipleTimes = input.length - 1
  
  let output = 1
  for(let i=0; i<input.length; i++){
      if(output.toString(10).length + input[i].toString(10).length  === 18) {
        if((output.split(' ')[output.length-1] * input[i].split(' ')[input[i].length-1])%10 != 0){
            console.log('-1')
            return
        }
      }

      if(output.toString(10).length + input[i].toString(10).length >= 19){
        console.log('-1')
        return
      }
      
      output *= input[i]
  }

    console.log(output)


}

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

