What is wrong in the approach 1 of sum of all submatrix from a given matrix