Problem: Egor has a table of size , with lines numbered from to and columns numbered from to . Each cell has a color that can be presented as an integer from to .
Let us denote the cell that lies in the intersection of the -th row and the -th column as . We define the manhattan distance between two cells and as the length of a shortest path between them where each consecutive cells in the path must have a common side. The path can go through cells of any color. For example, in the table the manhattan distance between and is , one of the shortest paths is the following: .
Egor decided to calculate the sum of manhattan distances between each pair of cells of the same color. Help him to calculate this sum.
Input Format: The first line contains two integers and (, ) — number of rows and columns in the table.
Each of next lines describes a row of the table. The -th line contains integers () — colors of cells in the -th row.
Output Format: Print one integer — the the sum of manhattan distances between each pair of cells of the same color.
Note: In the first sample there are three pairs of cells of same color: in cells and , in cells and , in cells and . The manhattan distances between them are , and , the sum is .