Stepan's House#10139

Stepan's House

1 second
64 megabytes
Medium

Stepan recently acquired a plot of land in a prestigious area and plans to construct a modern house on it. The plot is a rectangle measuring N \times M meters. According to the area's prestige regulations, the house must also be rectangular, with its walls parallel to the plot's sides. Additionally, the distance from any house wall to the nearest parallel boundary of the plot must be an integer number of meters. Naturally, Stepan aims to build a house with the largest possible area.

However, there is a challenge: two water wells are located on the plot. According to the same prestige rules, one well must be inside the house, while the other must remain outside its boundaries.

Your task is to help Stepan determine the maximum area of the house he can construct while complying with these prestige rules.

Input

Consider Stepan's plot as being divided into 1 \times 1 squares. Each well occupies one square, and they are located in different squares. The vertices of the house must align with the vertices of these squares.

The first line of the input contains two integers (2 \leq N, M \leq 1000). Each of the following lines contains integers, representing the squares with and . A in a square indicates the presence of a well.

It is guaranteed that there are exactly two wells, meaning there are exactly two squares with a .

Output

Output a single number – the maximum area of the house that Stepan can build while adhering to the prestige rules.

Examples

Example 1

Loading
Loading