Five-star challenge#1862

Five-star challenge

1 second
256 megabytes
Easy

In the initially empty rectangle, it is allowed to place five stars in a row vertically or horizontally, without exceeding the boundaries of the rectangle. In this case, different "five" placements are allowed to cross and overlap each other.

You are given the location of stars in the rectangle. Can this configuration be obtained by the above rules, and if so, what is the minimum number of "fives" that should be placed to obtain it?

Input

The first line of the input file contains two integers and — the height and width of the rectangle (1 \leq m \leq 5; 1 \leq n \leq 10).

Each of the next lines contains characters: "*" and ".", corresponding to an asterisk and an empty cell, respectively.

Output

Output if this configuration cannot be obtained. Otherwise, output the smallest number of "fives" which can be used to obtain this configuration.

Examples

Example 1

Loading
Loading