Nuts for nuts#2302

Nuts for nuts

1 second
128 megabytes
Very easy

Ryan and Larry decided that their own nuts do not taste very good. However, there are some nuts in certain places on the island that are very tasty! Since the boys are lazy and greedy, they want to find the shortest path to collect all the tasty nuts. Can you help them?

Input

The first line of each test case contains the dimensions of the rectangular island and (x, y \leq 20). Then follow lines, each containing characters, describing the map. The map consists of the symbols , #, and . Initially, Larry and Ryan are at , and the nuts are marked by #; empty cells are marked by . In one step, the boys can move to any of the adjacent cells. There are at most cells with nuts. The map contains exactly one cell marked .

Output

For each map, print on a separate line the minimum number of steps required to start at , collect all the nuts, and return to .

Examples

Example 1

Loading
Loading