Spare the Ewoks!

Time limit3sMemory limit128 MB

Problem

The Galactic Empire wants to build a new base on the forest moon of Endor. Endor is home to a species of small, cuddly creatures called the Ewoks, and you have been ordered not to disturb any existing Ewok home. Subject to that, you must make the base as large as possible in total area, and that area may be split among up to three rectangular buildings.

You are given a map of Endor as an $m \times n$ grid. Each cell is either empty or an Ewok home. Place up to three (possibly fewer) axis-aligned rectangular buildings on the grid so that no two buildings overlap and no building is placed on an Ewok home. Maximize the total area covered by the buildings.

Input

The input contains several test cases.

Each test case begins with a line containing two integers $m$ and $n$ ($1 \le m \le 250$, $1 \le n \le 250$), the number of rows and columns of the grid. The next $m$ lines describe the map; each line contains exactly $n$ characters, where . (a period) is an empty cell and e (a lowercase letter e) is an Ewok home.

The input ends with a line containing 0 0, which must not be processed.

Output

For each test case, print a single line containing one integer: the maximum total area that can be covered by up to three non-overlapping rectangular buildings that avoid every Ewok home.