Under construction

Still being built. Things may change

Fort Moo

Time limit2sMemory limit512 MB

Summary
Find the largest interior area of a grid rectangle whose border cells are all grass, with swamp allowed inside.
Level

Medium6 of 10

Topics
Prefix sum, Brute force, Matrix
Solved
No attempts yet

Problem

Bessie is building a fort with her friend Elsie. Like any good fort, this one starts with a sturdy frame. Bessie wants to build the frame as a rectangular outline one meter wide, and then raise the fort on top of it.

She has already picked the site, a piece of land NN meters by MM meters with 1≤N,M≤2001 \le N, M \le 200. Parts of the site are swampy and cannot support the frame. Find the largest area Bessie can cover with her fort, meaning the area of the rectangle that the frame encloses, when the frame sits on no swampy cell.

The rectangle can be as small as 1×11 \times 1. Only the cells on the outline have to be grass, and the cells inside may be swampy.

Input

The first line contains the integers NN and MM.

Each of the next NN lines contains MM characters describing the site. A '.' is normal grass and an 'X' is a swampy spot.

Output

Print one integer, the maximum area Bessie can cover with her fort. Print 0 if the frame fits nowhere.

Hint

In the first example the optimal frame is marked with 'f'.

.ffff.
.fX.fX
Xf.Xf.
.ffff.
..X...

Examples2

  1. Example 1

    Input
    5 6
    ......
    ..X..X
    X..X..
    ......
    ..X...
    
    Expected output
    16
    
  2. Example 2

    Input
    1 1
    .
    
    Expected output
    1