cho.sh
Notes
Loading...

Largest L Shape

Time limit

2s

Memory limit

128 MB

Problem

A picture made of 0s and 1s is drawn on an n x m grid. You may use only cells whose value is 1 to form an L shape.

In this problem, an L shape is the union of two axis-aligned rectangles that share the same lower-left corner. The lower rectangle must be wider than the upper rectangle, and the upper rectangle must be taller than the lower rectangle. Rotations and reflections of the L shape are not considered, and a plain rectangle is not an L shape.

Find the largest possible area of an L shape contained in the picture and output that area. The input contains at least one valid L shape.

Input

The first line contains two integers n and m. Each of the next n lines contains a string of length m. Every character is either 0 or 1.

Output

Print the maximum area of an L shape that can be formed.

Constraints

  • 1 <= n, m <= 150