#include using namespace std; //#include //using namespace atcoder; typedef long long ll; typedef unsigned long long ull; const int MAX = 1e9; const int MIN = -1*1e9; const ll MAXLL = 1e18; const ll MINLL = -1*1e18; //const ll MOD = 998244353; //const ll MOD = 1000000007; int main() { ll N,M; cin >> N >> M; vector V(N); for(int i = 0; i < N; i++) { for(int j = 0; j < M; j++) { ll A; cin >> A; V[i] += A; } } vector> DP(N+1,vector(N+1,MINLL)); DP[0][0] = 0; for(int i = 0; i < N; i++) { for(int j = 0; j <= i; j++) { DP[i+1][j] = max(DP[i+1][j],DP[i][j]); DP[i+1][j+1] = max(DP[i+1][j+1], DP[i][j]+((j+1)%2==0?-V[i]:V[i])); } } ll Ans = MINLL; for(int i = 0; i <= N; i++) Ans = max(Ans,DP[N][i]); cout << Ans << endl; return 0; }