#include <iostream>
#include <vector>

using ll = long long;

ll chmax(ll &x, const ll &y){
	if(x < y) x = y;
	return x;
}

int main(){
	int n, m;
	std::cin >> n >> m;
	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;
			a += tmp;
		}
		chmax(plus, minus + a);
		chmax(minus, plus - a);
	}
	std::cout << std::max(plus, minus) << std::endl;
}