cho.sh
Notes
Loading...

Shadow

Time limit

2s

Memory limit

128 MB

Problem

A rectangular room of size N x M is divided into 1 x 1 unit cells. . is an empty cell, # is a wall that blocks light, and * is a light source. There is exactly one light source, treated as a point at the center of the * cell.

For a point in an empty cell, light reaches that point if the line segment from the light source to the point does not intersect the interior of any wall cell. Empty space that light cannot reach is shadow. Wall cells block light, but their own area is not included in the area to output.

Given the room, compute the area of empty space that is in shadow.

Input

The first line contains two positive integers N and M. Both N and M are at most 50.

The next N lines describe the room. . is an empty cell, # is a wall, and * is the light source. Exactly one light source is given.

Output

Print the shadow area on the first line. An absolute or relative error of at most 10^-9 is accepted.