#abc186b. [abc186_b]Blocks on Grid

[abc186_b]Blocks on Grid

Problem Statement

We have a grid with HH horizontal rows and WW vertical columns. The square at the ii-th row from the top and jj-th column from the left has Ai,jA_{i, j} blocks stacked on it.

At least how many blocks must be removed to make all squares have the same number of blocks?

Constraints

  • 1leqH,Wleq1001 \\leq H,W \\leq 100
  • 0leqAi,jleq1000\\leq A_{i,j} \\leq 100

Input

Input is given from Standard Input in the following format:

HH WW A1,1A_{1,1} A1,2A_{1,2} ldots\\ldots A1,WA_{1,W} vdots\\vdots AH,1A_{H,1} AH,2A_{H,2} ldots\\ldots AH,WA_{H,W}

Output

Print the minimum number of blocks that must be removed.


Sample Input 1

2 3
2 2 3
3 2 2

Sample Output 1

2

Removing 11 block from the top-right square and 11 from the bottom-left square makes all squares have 22 blocks.


Sample Input 2

3 3
99 99 99
99 0 99
99 99 99

Sample Output 2

792

Sample Input 3

3 2
4 4
4 4
4 4

Sample Output 3

0