N,M = list(map(int,input().split())) boxes = [list(map(int,input().split())) for _ in range(N)] totals = [sum([boxes[j][i] for j in range(N)]) for i in range(M)] values = [sum([boxes[i][j]*totals[j] for j in range(M)]) for i in range(N)] values.sort() print(sum([values[i] * (-1)**(i+1) for i in range(N)]))