#include #include #include using ll = long long; void chmax(ll &x, const ll &y){ if(x < y) x = y; } int main(){ int n, m; std::cin >> n >> m; assert(1 <= n && n <= 1000); assert(1 <= m && m <= 1000); ll plus = 0, minus = 0; for(int i = 0; i < n; ++i){ ll a = 0; for(int j = 0; j < m; ++j){ ll tmp; std::cin >> tmp; assert(1ll <= tmp && tmp <= 10000000000ll); a += tmp; } chmax(plus, minus + a); chmax(minus, plus - a); } std::cout << std::max(plus, minus) << std::endl; }