Background
A problem for top students.
Counting cubes.
Description
Little E has a rectangular area of size $n \times m$, consisting of $n \times m$ grid cells of side length $1$. On the cell at row $i$ and column $j$, there are $A_{ij}$ identical cubic blocks stacked. After solving a problem, Little E had a sudden inspiration and drew these cubes as ASCII art. He wants you to help him count the total number of cubes. Each cube is represented in the following format, without any rotation, and is strictly placed in this orientation:
..+---+ ./ /| 高 +---+ | | | + | |/.宽 +---+.. 长
Each vertex is represented by one +, the length by three -, the width by one /, and the height by two |. The character . is used as the background. The empty space in the middle consists of spaces (ASCII code $32$).
If two cubes are adjacent horizontally, the diagram is:
..+---+---+ ./ / /| +---+---+ | | | | + | | |/. +---+---+..
If two cubes are adjacent vertically (in the grid sense), the diagram is:
..+---+ ./ /| +---+ | | | + | |/| +---+ | | | + | |/. +---+..
If two cubes are adjacent in the depth direction, the diagram is:
....+---+ .../ /| ..+---+ | ./ /| + +---+ |/. | | +.. | |/... +---+....
The faces of cubes in the front will obscure the faces of cubes behind them. To ensure clarity, no entire column of cubes is hidden behind others; Little E guarantees that $1 \le A_{ij} \le A_{i-1,j}$ and $1 \le A_{ij} \le A_{i,j-1}$. Furthermore, there are no full rows or columns of . in the diagram. Thus, one ASCII drawing corresponds to a unique matrix $A$, and one matrix $A$ corresponds to a unique ASCII drawing.
Input
Read from standard input.
The first line contains two positive integers $r$ and $c$, representing the height and width of the drawing (note that these are not $n$ and $m$).
The following $r$ lines contain the $c$ characters of the ASCII drawing representing the stacked cubes.
Output
Output to standard output.
A single integer representing the total number of cubes.
Examples
Input 1
14 17 ....+---+---+.... .../ / /|.... ..+---+---+ |.... ./ /| | +---+ +---+ | |/ /| | | +---+---+ | | |/ /| | + +---+---+ | |/| | | | +---+ | | | |/ /| + +---+---+---+ |/. | | | | +.. | | | |/... +---+---+---+....
Output 1
14
Note 1
In this case, the matrix $A$ is $\begin{bmatrix}3 & 3 & 2\\3 & 2 & 1\end{bmatrix}$. Since $3+3+3+2+2+1=14$, there are $14$ cubes in total.
Subtasks
It is guaranteed that $1 \le n, m \le 50$ and $1 \le A_{ij} \le 100$ (note that these are $n$ and $m$, not $r$ and $c$).
It is guaranteed that $\forall 1 < i \le n$, $A_{ij} \le A_{i-1,j}$.
It is guaranteed that $\forall 1 < j \le m$, $A_{ij} \le A_{i,j-1}$.
It is guaranteed that there is no full row or column of . in the ASCII drawing.