Secret bunker#507

Secret bunker

1 second
64 megabytes
Hard

The layout of a secret bunker is depicted as a rectangular grid. In this grid, bombs are marked with the symbol , secret objects with the symbol and empty spaces with the symbol . In the event of a threat, detonating any bomb should ensure the destruction of all secret objects. When a bomb explodes, it destroys all objects for which the distance from the center of the bomb's cell to the center of the object's cell is or less. If another bomb is within this explosion radius, it will also detonate.

Your task is to write a program that calculates the minimum value of such that detonating any bomb results in the destruction of all secret objects.

Input

The input consists of multiple tests. The first line of each test provides two integers and separated by a space, representing the dimensions of the bunker plan (1 \leq N \leq 50, 1 \leq M \leq 50). This is followed by rows, each containing characters: , , and . The plan includes between and symbols and between and symbols. A line with indicates the end of the test set and should not be processed.

Output

For each test, output a single line containing the minimum value of for the respective plan, with a precision of 10^{-6}.

Examples

Example 1

Loading
Loading