#EMILABC. Big Pyramid

Big Pyramid

Archeologists have discovered an ancient manuscript describing a big pyramid. The pyramid is built of cubical stone blocks as shown in the picture. There are N horisontal levels in the pyramid. The topmost level consists of a single block, and the base level is a square of 2*N-1×2*N-1 blocks. The archeologists learned from the manuscript the size of a stone block and the orientation the pyramid. However, they do not know the size and the exact location of the pyramid.

There are many hills in the land where the pyramid is believed to be located. The archeologists think that one of the hills is actually the pyramid covered with sand. To check that hypothesis, they produced an elevation map of the land. The land was divided into a grid of H×W cells. The size of a cell is the same as the size of a stone block face. For each cell they measured its height and calculated how many stone blocks can be underneath the surface of the cell.

Now the archeologists give you the elevation map and ask to compute the largest possible pyramid size, assuming that the pyramid base sides are parallel to the grid lines.

Input

The first line of the input contains two integers H and W (0 < H, W ≤ 200). Each of the subsequent H lines contains W integers. Each integer is non-negative and less than 201.

Output

One interger - the number of levels in the larget possible pyramid.

Example

Input:

5 6
0 0 0 0 0 0
0 1 0 0 0 0
0 0 1 1 1 1
0 0 1 1 2 1
0 0 1 1 1 1

Output:

2