n,m=map(int,input().split()) cnt=[0]*m a=[] for i in range(n): b=list(map(int,input().split())) a.append(b) for j in range(m): cnt[j]+=b[j] c=[] for i in range(n): tmp=0 for j in range(m): tmp+=cnt[j]*a[i][j] c.append(tmp) c.sort() print(sum(c[1::2])-sum(c[::2]))