#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N,M; cin >> N >> M; vector A(N, 0); rep(i,N)rep(j,M){ int a; cin >> a; A[i] += a; } ll dp0 = -1e18, dp1 = 0; rep(i,N) tie(dp0, dp1) = make_pair(max(dp0, dp1 + A[i]), max(dp1, dp0 - A[i])); cout << max(dp0, dp1) << endl; }