def main1(n,m,a): ary=[0]*m for x in a: for j in range(m): ary[j]+=x[j] b=[] for x in a: tmp=0 for j in range(m): tmp+=x[j]*ary[j] b.append(tmp) b.sort() x=sum([v for v in b[::2]]) y=sum([v for v in b[1::2]]) return abs(x-y) if __name__=='__main__': n,m=map(int,input().split()) a=[list(map(int,input().split())) for _ in range(n)] ret1=main1(n,m,a) print(ret1)