submatrix maxsum dynamic programming