import java.util.Scanner;
import java.math.*;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while(in.hasNextInt()){
int n = in.nextInt();
int m = in.nextInt();
int[][] arr = new int[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
arr[i][j] = in.nextInt();
}
}
//模拟 暴力
long max = 0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
//当前i j元素对应的结果
long currRes = 1;
for(int col=0;col<m;col++){
if(col!=j) currRes*=arr[i][col];
}
for(int row=0;row<n;row++){
if(row!=i) currRes*=arr[row][j];
}
max = Math.max(max,currRes);
}
}
System.out.println(max);
}
}
}