#include <iostream>

using namespace std;

long long suma(long long x1, long long y1, long long x2, long long y2, int mat[][100]){
    int sum =0;
    for (int i = x1; i<x2; i++){
        for (int j = y1; j<y2; j++){
            sum+=mat[i][j];
        }
    }
    return sum;
}

long long res (int mat[][100], int n, int m, int x, int y, long long sum){
    if (n-1==x && m-1==y){return sum;}
    //cout << x<<" "<<y<< " "<< suma(x, y+1, x, m, mat) << " " << suma(x+1, y, n, y, mat)  <<"\n";
    if (suma(x, y+1, n, m, mat)>suma(x+1, y, n, m, mat)){
        res(mat, n, m, x, y+1, sum+suma(x, y+1, n, m, mat)-suma(x+1, y+1, n, m, mat));
    }
    else{
        res(mat, n, m, x+1, y, sum+suma(x+1, y, n, m, mat)-suma(x+1, y+1, n, m, mat));
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n, m;
    cin >> n >> m;
    int mat[n][100];

    for (int i = 0; i<n; i++){
        for (int j =0; j<m; j++){
            cin >> mat[i][j];
        }
    }

    cout << res (mat, n, m, 0, 0, 0);



    return 0;
}