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()){
        line0 = line.split(' ');
        line0Int = line0.map(Number);
        linen = new Array;
        for(let i=0; i<line0Int[0]; i++){
            matrixlinen = await readline();
            matrixlinens = matrixlinen.split(' ');
            matrixlinensInt = matrixlinens.map(Number);
            linen.push(matrixlinensInt);
        }
        matrix = linen;
        let max =0;
        for(let i=0; i<line0Int[0]; i++){
            for(let j=0; j<line0Int[1]; j++){
                let xijm = 1;
                for(let m=0; m<line0Int[1]; m++){
                    if(m!=j){
                        xijm *= matrix[i][m];
                    }
                }
                for(let n=0; n<line0Int[0]; n++){
                    if(n!=i){
                        xijm *= matrix[n][j];
                    }

                }
                result = xijm;
                max = Math.max(max, result);
            } 
        }
        console.log(max);
    }
}()