// Arup Guha
// 7/22/2013
// Solution to 2013 World Finals Problem: Pirate

import java.util.*;

public class pirate {

	public static int boxR;
	public static int boxC;
	public static int pondR;
	public static int pondC;
	public static int[][] pond;

	public static void main(String[] args) {

		// Read in box and pond dimensions.
		Scanner stdin = new Scanner(System.in);
		int maxBoxR = stdin.nextInt();
		int maxBoxC = stdin.nextInt();
		boxR = Math.min(maxBoxR, maxBoxC);
		boxC = Math.max(maxBoxR, maxBoxC);
		pondR = stdin.nextInt();
		pondC = stdin.nextInt();
		pond = new int[pondR][pondC];

		// Read in pond.
		for (int i=0; i<pondR; i++)
			for (int j=0; j<pondC; j++)
				pond[i][j] = stdin.nextInt();

		System.out.println(solve());
	}

	public static long solve() {

		// Indicates no solution at first.
		long best = 0;

		// i and j represent all possible starting and ending columns of the placement of our box.
		for (int i=0; i<pondC; i++) {

			// Initialize each column's depth.
			int[] depths = new int[pondR];
			for (int k=0; k<pondR; k++)
				depths[k] = pond[k][i];

			for (int j=i; j<i+boxC && j<pondC; j++) {

				long width = (long)(j-i+1);
				int maxDim = boxR;
				if (width <= boxR)
					maxDim = boxC;

				// Update this column's minimums.
				for (int k=0; k<pondR; k++)
					depths[k] = Math.min(depths[k], pond[k][j]);

				Stack<pair> s = new Stack<pair>();
				for (int k=0; k<pondR; k++) {

					// Automatically add new start.
					if (s.size() == 0 || depths[k] > s.peek().depth)
						s.push(new pair(k, k, depths[k]));

					else {

						// Evaluate all intervals that are stopping here.
						while (s.size() > 0 && depths[k] <= s.peek().depth) {
							pair done = s.pop();
							long temp = f(width*((long)Math.min(k-done.start, maxDim)), (long)done.depth);
							if (temp > best)
								best = temp;
						}

						// Add in the current interval.
						if (s.size() == 0)
							s.push(new pair(0, k, depths[k]));
						else if (depths[k] > s.peek().depth)
							s.push(new pair(s.peek().index+1, k, depths[k]));
					}
				}

				// Evaluate all intervals that are open at the end column.
				while (s.size() > 0) {
					pair done = s.pop();
					long temp = f(width*((long)Math.min(pondR-done.start, maxDim)), (long)done.depth);
					if (temp > best)
						best = temp;
				}
			}
		}

		return best;
	}

	// Returns the best answer given this particular cross sectional area and this depth.
	public static long f(long crossArea, long thisDepth) {

		// Regular volume without accounting for displaced water.
		long curVol = thisDepth*crossArea;

		// This is how high the displaced water allows the box to go.
		long extra = (curVol-1)/( ((long)(pondR*pondC)) - crossArea);

		// Calculate this adjusted volume and return.
		curVol = (thisDepth + extra)*crossArea;
		return curVol;
	}

}

class pair {

	public int start;
	public int index;
	public int depth;

	public pair(int myStart, int ID, int deep) {
		start = myStart;
		index = ID;
		depth = deep;
	}
}