Limits 1s, 512 MB

You will be given an R×CR \times C grid of asterisks (*\texttt{*}) and dots (.\texttt{.}). The grid is the top-left view of an infinitely repeating pattern of diamonds. And, it is guaranteed that at least one asterisk will be present on the grid given to you.

The size of a diamond is defined by an integer DD.

When D=1D = 1,

*

When D=2D = 2,

.*.
***
.*.

When D=3D = 3,

..*..
.***.
*****
.***.
..*..

When D=4D = 4,

...*...
..***..
.*****.
*******
.*****.
..***..
...*...

And, so on.

Given such a grid you have the determine the DD for the diamond.

Input

The input will start with two integers RR and CC (1R,C101 \le R, C \le 10).

The following RR lines will contain CC characters each (either asterisks or dots), representing the grid.

Output

Print the size of the diamond in the pattern in the grid as defined in the problem statement.

Sample

InputOutput
10 10
..*....*..
.***..***.
**********
.***..***.
..*....*..
..*....*..
.***..***.
**********
.***..***.
..*....*..
3

Submit

Login to submit.

Statistics

65% Solution Ratio
EgorKulikovEarliest, 7M ago
pathanFastest, 0.0s
EgorKulikovLightest, 5.5 MB
Nusab19Shortest, 68B
Toph uses cookies. By continuing you agree to our Cookie Policy.