First part of my code of problem sum of all submatrices