const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void async function () { // Write your code here while(line = await readline()){ nums = await readline(); len = parseInt(line); nums = nums.split(' '); let arr = nums.map(a => Number(a)); let arrs = arr.sort((a,b) => a-b); console.log(Math.max(arrs[len-1] * arrs[len-2] * arrs[len-3], arrs[len-1] * arrs[1] * arrs[0])); } }()