import java.io.*;
import java.util.*;

public class garnett_pk {

	void solve() throws IOException {
		int n = nextInt();
		int m = nextInt();
		int minX = Integer.MAX_VALUE;
		int minY = Integer.MAX_VALUE;
		int maxX = Integer.MIN_VALUE;
		int maxY = Integer.MIN_VALUE;
		for (int x = 0; x < n; x++) {
			for (int y = 0; y < m; y++) {
				int t = nextInt();
				if (t == 0)
					continue;
				minX = Math.min(minX, x);
				minY = Math.min(minY, y);
				maxX = Math.max(maxX, x);
				maxY = Math.max(maxY, y);
			}
		}
		
		int ans = 0;
		if (minX != maxX) {
			ans = Math.max(m * maxX, m * (n - minX - 1));
		}
		if (minY != maxY) {
			ans = Math.max(ans, Math.max(n * maxY, n * (m - minY - 1)));
		}
		out.println(ans);
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;

	void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			br = new BufferedReader(new FileReader(new File("garnett.in")));
			out = new PrintWriter("garnett.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		new garnett_pk().run();
	}

	String nextToken() throws IOException {
		while ((st == null) || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextToken());
	}
}
