#include <bits/stdc++.h>
#define INF 1e+18
#define int long long
using namespace std;

int dp[1001][1001],w,h,s[1001][1001];

int calc(int x1,int x2,int y1,int y2){
	return s[x2 + 1][y2 + 1] - s[x2 + 1][y1] - s[x1][y2 + 1] + s[x1][y1];
}

int dfs(int x,int y){
	if(x == h || y == w) return 0;
	if(dp[x][y] != INF) return dp[x][y];
	if((x + y) % 2 == 0) return dp[x][y] = max(dfs(x + 1,y) + calc(x,x,y,w - 1),dfs(x,y + 1) - calc(x,h - 1,y,y));
	else return dp[x][y] = min(dfs(x + 1,y) + calc(x,x,y,w - 1),dfs(x,y + 1) - calc(x,h - 1,y,y));
}

signed main(){
	cin >> w >> h;
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			cin >> s[i + 1][j + 1];
		}
	}
	for(int i = 0;i <= h;i++){
		for(int j = 0;j <= w;j++) dp[i][j] = INF;
	}
	for(int i = 1;i <= h;i++){
		for(int j = 1;j <= w;j++){
			s[i][j] += s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1];
		}
	}
	cout << abs(dfs(0,0)) << endl;
	return 0;
}