print(maximal_sum(M))
M = np.matrix([[1, 2], [3, -4]])
print(maximal_sum(M))
M = np.matrix([[2, -2, 2, 2], [2, 2, 2, 2], [2, 2, -2, 2], [2, 2, 2, 2], [2,
    2, 2, 1]])
print(maximal_sum(M))
Make the sum of integers in a matrix maximal by multiplying rows and columns by -1