eolymp
Competitions

Хвиля

Holey fabric

On the table lay a few pieces of fabric, not overlapping each other. These pieces may have holes, including is so large that they can fit a piece of cloth. Was a black and white image of a table surface on which the area covered with a cloth is represented by a *, and free premises - points. One piece of cloth, thus presenting a 4-connected region of the characters *, that is, group *, adjacent to each other horizontally or vertically but not diagonally.

.***..***

.*.*.**.*

.***.*.**

*...**.*.

In the diagram, three pieces - one without holes, and two - with one hole each: the first area of 8, the second - an area of 12.

Your goal - to find a piece with the greatest number of holes in it. Hole - a 4-connected region of points, is completely surrounded by a *. If some pieces have the same number of holes, you should choose a piece of minimum area.

Input

The first line contains two numbers W and H, separated by spaces. The next H rows of W contain characters each. The symbols in these rows or *, or a point.

1W, H100.

Output

Print a single integer - the minimum area of the holey pieces. If no pieces with holes, the output file should contain zero.

Time limit 1 second
Memory limit 64 MiB
Input example #1
9 5
.********
.*......*
.*..**..*
.*......*
.********
Output example #1
22