#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int w,h;
int t[1005][1005],y[1005][1005];
int dp[1005][1005];
int main(void){
    scanf("%d%d",&w,&h);
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            int x;
            scanf("%d",&x);
            t[i][j]+=x;
            y[i][j]+=x;
            t[i+1][j]+=t[i][j];
            y[i][j+1]+=y[i][j];
        }
    }
    for(int i=h;i>=0;i--){
        for(int j=w;j>=0;j--){
            int x=dp[i+1][j]+y[i+1][w]-y[i+1][j],y=dp[i][j+1]+t[i][j+1]-t[h][j+1];
            if(i==h)dp[i][j]=y;
            else if(j==w)dp[i][j]=x;
            else{
                if((i+j)%2==0)dp[i][j]=max(x,y);
                else dp[i][j]=min(x,y);
            }
        }
    }
    printf("%d\n",abs(dp[0][0]));
}
