N, M = map(int, input().split()) A = [list(map(int, input().split())) for _ in range(N)] S = [0] * M for i in range(N): for j in range(M): S[j] += A[i][j] data = [sum(S[j]*A[i][j] for j in range(M)) for i in range(N)] data.sort() ans = sum(data[1:N:2]) - sum(data[0:N:2]) print(ans)