Xiao C and the grid are good friends.
Xiao C has a grid with $n$ rows and $m$ columns, where each cell contains a number. The number in the cell at row $i$ and column $j$ is $a_{i,j}$.
We define that two distinct cells are not adjacent if and only if they do not share a common edge.
Xiao C considers two distinct cells to be "good friends" if and only if they are not adjacent and the numbers in these two cells are the same.
Xiao C wants you to help calculate the sum of the number of good friends for all cells in the grid.
Input
The first line contains two integers $n$ and $m$.
The next $n$ lines each contain $m$ integers, where the $j$-th integer in the $i$-th line represents $a_{i,j}$.
Output
A single integer representing the sum of the number of good friends for all cells.
Examples
Input 1
3 4 1 1 4 5 2 1 2 3 3 1 4 1
Output 1
20
Note 1
The cell at row $1$, column $1$ has $3$ good friends; the cell at row $1$, column $2$ has $2$ good friends; the cell at row $1$, column $3$ has $1$ good friend; the cell at row $1$, column $4$ has $0$ good friends.
The cell at row $2$, column $1$ has $1$ good friend; the cell at row $2$, column $2$ has $2$ good friends; the cell at row $2$, column $3$ has $1$ good friend; the cell at row $2$, column $4$ has $1$ good friend.
The cell at row $3$, column $1$ has $1$ good friend; the cell at row $3$, column $2$ has $3$ good friends; the cell at row $3$, column $3$ has $1$ good friend; the cell at row $3$, column $4$ has $4$ good friends.
The sum of the number of good friends for all cells is $20$.
Examples 2-5
See the files square/square2.in through square/square5.in and their corresponding .ans files in the additional files. These examples satisfy the constraints of test cases $1, 4, 6,$ and $10$ respectively.
Constraints
For $100\%$ of the data, $1 \le n, m \le 2000$, $1 \le a_{i,j} \le 9$.
| Test Case ID | $n, m \le$ | $a_{i,j} \le$ | Special Property |
|---|---|---|---|
| $1\sim3$ | $80$ | $9$ | No |
| $4\sim5$ | $2000$ | $1$ | No |
| $6\sim7$ | $2000$ | $9$ | Yes |
| $8\sim10$ | $2000$ | $9$ | No |
Special Property: It is guaranteed that any two adjacent cells contain different numbers.