G. A Curiously Perfect Circle
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

You've invented the Armorstand Circle Placement Constructor (ACPC), a command to generate circles in Minecraft! Using repeating command blocks, ACPC generates a circle on the ground of a given radius $$$r$$$ by first spawning a central armor stand, which then repeatedly spawns another armor stand entity $$$r$$$ blocks in front of it and rotates slightly clockwise. The central armor stand then forces all the other armor stands to face inwards, creating the illusion of a circle.

You're planning to use ACPC to generate a circle as part of a house you're designing in a plains biome. You select a $$$N \times N$$$ area to place your circle, where $$$N$$$ is even, given as a 2D grid. Your circle will be centered at the middle of the grid. Within the grid, certain blocks have tall grass growing on them; you want to use this foliage as part of your design. A block without tall grass is marked as ., while a block with tall grass is marked as #.

You want to find the smallest radius $$$r$$$ to use such that the circle touches the most blocks with tall grass. Tall grass touches the circle if the circumference of the circle intersects or is tangent to the perimeter of that tile. A circle may have a radius of $$$0$$$, where it is just a point at the center of the grid. In this case, blocks with perimeters that contain this point are touching the circle. Notably, we're only considering the distance of the circle's circumference from the central point, disregarding the base areas of the individual armor stands. Additionally, the circle may extend out of the grid.

Given a $$$N \times N$$$ grid where $$$N$$$ is even, output the radius of the smallest circle centered in the middle of the grid with the circumference that touches the most tall grass!

Input

The first line of input is even integer $$$N$$$ ($$$2 \le N \le 500, \space N \text{ is even}$$$): the length of a side of the square grid. Following this are $$$N$$$ lines of length $$$N$$$ each: the square grid.

Output

Output a single floating-point value: the minimum radius of the circle that touches the most tall grass. Your answer will be accepted if it is within an absolute or relative error of $$$10^{-6}$$$ to the jury's answer.

Examples
Input
4
.##.
#..#
#..#
.##.
Output
1.0
Input
4
....
..#.
#...
#...
Output
1.4142135623730951
Input
2
.#
#.
Output
0.0
Input
14
...#......#...
..#........#..
.#..........#.
#............#
..####..####..
..#........#..
..####.....#..
..#..#.....#..
..#..#.....#..
..####.....#..
#............#
.#..........#.
..#........#..
...#......#...
Output
6.708203932499369
Input
2
..
..
Output
0.0
Input
8
#......#
........
........
........
........
........
........
#......#
Output
4.242640687119285
Note

On the first testcase, the maximum possible number of tall grass touched is $$$8$$$. The minimum radius of a circle that touches $$$8$$$ tall grass tiles is $$$1$$$.