#include #include #include using namespace std; using ll = long long; const int INF = 100100100; int main(){ int n , m; cin >> n >> m; vector a(n + 1 , 0); for(int i = 1; i <= n; i++){ for(int j = 0; j < m; j++){ ll now; cin >> now; a[i] += now; } } vector> dp(n + 10 , vector(2 , 0)); for(int i = 1; i <= n; i++){ dp[i][1] = max({dp[i - 1][1] , dp[i - 1][0] + a[i] , a[i]}); dp[i][0] = max(dp[i - 1][0] , dp[i - 1][1] - a[i]); } cout << max(dp[n][1] , dp[n][0]) << endl; return 0; }