#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX_H 1005
#define MAX_W 1005
ll INF=(1LL<<50);
int H,W;
ll t[MAX_H][MAX_W];
ll u[MAX_H][MAX_W];
ll dp[MAX_H][MAX_W];

int dy[]={-1,0};
int dx[]={0,-1};

int main(){
  cin>>W>>H;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>t[i][j];
      u[i][j+1]=t[i][j]+u[i][j];
    }
  }

  dp[H][W]=0;
  for(int i=H;i>=0;i--){
    for(int j=W;j>=0;j--){
      if(i==H&&j==W)continue;
      
      if((i+j)&1){
        dp[i][j]=INF;
        if(j+1<=W)dp[i][j]=min(dp[i][j],dp[i][j+1]);
        if(i+1<=H)dp[i][j]=min(dp[i][j],u[i][W]-u[i][j]-u[i][j]+dp[i+1][j]);
      }else{
        dp[i][j]=-INF;
        if(j+1<=W)dp[i][j]=max(dp[i][j],dp[i][j+1]);
        if(i+1<=H)dp[i][j]=max(dp[i][j],u[i][W]-u[i][j]-u[i][j]+dp[i+1][j]);
      }
    }
  }

  cout<< abs(dp[0][0]) <<endl;
  return 0;
}