{"raw_statement":[{"iden":"problem statement","content":"There is an $N \\times M$ grid, where the square at the $i$\\-th row from the top and $j$\\-th column from the left has a non-negative integer $A_{i,j}$ written on it.  \nLet us choose a rectangular region $R$.  \nFormally, the region is chosen as follows.\n\n*   Choose integers $l_x, r_x, l_y, r_y$ such that $1 \\le l_x \\le r_x \\le N, 1 \\le l_y \\le r_y \\le M$.\n*   Then, square $(i,j)$ is in $R$ if and only if $l_x \\le i \\le r_x$ and $l_y \\le j \\le r_y$.\n\nFind the maximum possible value of $f(R) = $ (the sum of integers written on the squares in $R$) $\\times$ (the smallest integer written on a square in $R$)."},{"iden":"constraints","content":"*   All input values are integers.\n*   $1 \\le N,M \\le 300$\n*   $1 \\le A_{i,j} \\le 300$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_{1,1}$ $A_{1,2}$ $\\dots$ $A_{1,M}$\n$A_{2,1}$ $A_{2,2}$ $\\dots$ $A_{2,M}$\n$\\vdots$\n$A_{N,1}$ $A_{N,2}$ $\\dots$ $A_{N,M}$"},{"iden":"sample input 1","content":"3 3\n5 4 3\n4 3 2\n3 2 1"},{"iden":"sample output 1","content":"48\n\nChoosing the rectangular region whose top-left corner is square $(1, 1)$ and whose bottom-right corner is square $(2, 2)$ achieves $f(R) = (5+4+4+3) \\times \\min(5,4,4,3) = 48$, which is the maximum possible value."},{"iden":"sample input 2","content":"4 5\n3 1 4 1 5\n9 2 6 5 3\n5 8 9 7 9\n3 2 3 8 4"},{"iden":"sample output 2","content":"231"},{"iden":"sample input 3","content":"6 6\n1 300 300 300 300 300\n300 1 300 300 300 300\n300 300 1 300 300 300\n300 300 300 1 300 300\n300 300 300 300 1 300\n300 300 300 300 300 1"},{"iden":"sample output 3","content":"810000"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}