/** * @FileName a.cpp * @Author kanpurin * @Created 2020.08.29 15:36:38 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n,m;cin >> n >> m; vector a(n); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ll b;cin >> b; a[i] += b; } } constexpr long long LLINF = 1e18 + 1; vector> dp(n+1,vector(2,-LLINF)); dp[0][1] = 0; ll one_max = 0, zero_max = -LLINF; for (int i = 0; i < n; i++) { dp[i + 1][0] = one_max + a[i]; dp[i + 1][1] = zero_max - a[i]; one_max = max(one_max,dp[i + 1][1]); zero_max = max(zero_max,dp[i + 1][0]); } cout << zero_max << endl; return 0; }