A fortress plan is a grid of R rows and C columns. A cell holds 1 where stone is laid and 0 where it is missing. A parapet is any axis-aligned square whose border cells (the top and bottom rows of the square and its left and right columns) are all 1; the cells strictly inside the square may be anything. A single 1 cell counts as a 1-by-1 parapet.
Determine the area (side length squared) of the largest parapet. If no cell is 1, the area is 0.
Input format
Line 1: two integers R and C.
Next R lines: each contains C integers, each 0 or 1.
Output format
A single integer: the area of the largest square with an all-1 border, or 0 if there is none.
Constraints
- 1 <= R <= 60
- 1 <= C <= 60
- Each cell is 0 or 1.