How Many Cubes

Time Limit: 5 Seconds    Memory Limit: 32768 KB

alsomagic hasn't any toys except cubes. He divided the table surface into N by M square cells (N, M respectively indicates the row and the column), on which was put the cubes. Some cubes are stacked one upon another over the cells, forming towers. Each cube can be represented as shown below:

  +---+
 /   /|
+---+ |
|   | +
|   |/
+---+
(here the characters used are '+', '-', '/', '|', their ASCII codes are ASCII 43, 45, 47, 124) 

The dot (ASCII 46) is used as a background. For example, the following is a pile of cubes on a 2 * 2 tables.

....+---+---+
.../   /   /|
..+---+---+ |
./   /|   | +
+---+ |   |/.
|   | +---+..
|   |/.......
+---+........

Now alsomagic has built a great tow, he wanted to know how many cubes was used. Of course, it is impossible to tell the exact number, as some cubes was hided by the one in front of it. You just need to tell him the MOST cubes of the tow may have.

Input

Input contains integers T N M, then T lines of strings followed, which descript the tow. (6<=T<=200, 1<=N, M<=50)

Some restriction of tower's pattern in the input.
* The background represent by dot is the minimal rectangle required to show all cubes.
* The height of the tow will not exceed then 25.
* The tow was descripting from nearest to furthest, left to right.

This problem contains 200 test cases!!! Each input block is in the format indicated in the problem description. There is a blank line between input blocks.

Output

Output the MOST cubes of the tow may have. One line per-case.

Sample Input

8 2 2
....+---+---+
.../   /   /|
..+---+---+ |
./   /|   | +
+---+ |   |/.
|   | +---+..
|   |/.......
+---+........

11 2 2
........+---+
......./   /|
..+---+---+ |
./   /   /| +
+---+---+ |/|
|   |   | + |
|   |   |/| +
+---+---+ |/.
|   |   | +..
|   |   |/...
+---+---+....

Sample Output

3
7
Submit

Source: ZOJ Monthly, February 2005