#include #define REP(i, n) for(int i = 0; (i) < (n); (i)++) using namespace std; int main() { int N, M; cin >> N >> M; long A[400][400]; REP(i, N) REP(j, M) cin >> A[i][j]; long S[400], V[400]; REP(i, M) S[i] = 0l; REP(i, M) REP(j, N) S[i] += A[j][i]; REP(i, N) V[i] = 0l; REP(i, N) REP(j, M) V[i] += A[i][j] * S[j]; sort(V, V+N); long ans = 0l; REP(i, N/2) ans += (V[2*i+1] - V[2*i]); cout << ans << endl; return 0; }