Under construction

Still being built. Things may change

Moon in the Photo

Interview

Time limit2sMemory limit512 MB

Summary
Find the largest circle that contains no black pixels in a grid of white and black points, and print its radius and center as column then row.
Level

Easy3 of 10

Topics
Brute force, Geometry
Solved
No attempts yet

Problem

Dasha is a beginner astronomer who finally bought a digital camera. Taking pictures of the night sky with a button press and studying them later is much more convenient.

The camera sensor does not have a high resolution, and night photos show only two colors, black and white. Dasha has already taken a huge number of pictures, and her memory card is not full yet. She wants to know where the Moon is in each photo.

The Moon looks like a circle with center point CC and a non-negative integer radius rr. In other words, it is the set of white points whose distance from CC is at most rr. The Moon fits entirely inside the photo.

Some bright stars may also appear as single white points. There are at most 25 of them. No other objects appear in the photo.

Write a program that finds the largest possible radius of a circle that matches the Moon, along with a possible position of its center.

Input

The first line contains integers ww and hh, the horizontal and vertical resolution of the photo (1⩽w,h⩽501 \leqslant w, h \leqslant 50). Each of the next hh lines contains ww characters, either "." (black point) or "*" (white point).

Output

On the first line, print the maximum radius of the Moon as a natural number. On the second line, print the coordinates of the Moon's center for that radius, column first and then row. Columns and rows are numbered from 1, left to right and top to bottom, respectively.

If there are several possible centers, print any of them. It is guaranteed that a valid answer exists.

Examples2

  1. Example 1

    Input
    7 8
    .*.*...
    .*****.
    .*****.
    *******
    .*****.
    .*****.
    ...*...
    ......*
    
    Expected output
    3
    4 4
    
  2. Example 2

    Input
    5 4
    .....
    .....
    ..*..
    .*...
    
    Expected output
    0
    2 4