NEO

No attempts yetTime limit1sMemory limit256 MB

Problem

Write Ai,jA_{i,j} for the element of matrix AA in row ii and column jj. A matrix AA with rr rows and ss columns is cool if both of these hold.

  • r>1r > 1 and s>1s > 1
  • A1,1+Ar,sA1,s+Ar,1A_{1,1} + A_{r,s} \le A_{1,s} + A_{r,1}

A matrix with at least two rows and at least two columns is extremely cool if every submatrix of it that has at least two rows and at least two columns is cool.

A submatrix is the rectangular region where a range of consecutive rows meets a range of consecutive columns.

Find an extremely cool submatrix of the given matrix and report the largest number of elements such a submatrix can have.

Input

The first line contains two integers RR and SS, the dimensions of the matrix (2R,S10002 \le R, S \le 1000).

Each of the next RR lines contains SS integers, one row of the matrix. Every element is an integer between 106-10^6 and 10610^6.

Output

Print one line with the largest number of elements an extremely cool submatrix of the given matrix has. If the matrix has no extremely cool submatrix, print 0.