#include<iostream>
using namespace std;
int a[200][200],H,W;
int solve(int ax,int ay,int bx,int by){
int maxn=0;
if(ax<H-1 && bx<H-1){int B=0;if(ax!=bx || ay!=by){B=a[bx][by];}maxn=max(maxn,solve(ax+1,ay,bx+1,by)+a[ax][ay]+B);}
if(ay<W-1 && bx<H-1){int B=0;if(ax!=bx || ay!=by){B=a[bx][by];}maxn=max(maxn,solve(ax,ay+1,bx+1,by)+a[ax][ay]+B);}
if(ax<H-1 && by<W-1){int B=0;if(ax!=bx || ay!=by){B=a[bx][by];}maxn=max(maxn,solve(ax+1,ay,bx,by+1)+a[ax][ay]+B);}
if(ay<W-1 && by<W-1){int B=0;if(ax!=bx || ay!=by){B=a[bx][by];}maxn=max(maxn,solve(ax,ay+1,bx,by+1)+a[ax][ay]+B);}
//cout<<ax<<' '<<ay<<' '<<bx<<' '<<by<<' '<<maxn<<endl;
return maxn;
}
int main(){
cin>>H>>W;for(int i=0;i<H;i++){for(int j=0;j<W;j++)cin>>a[i][j];}
cout<<solve(0,0,0,0)+a[H-1][W-1]<<endl;
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBhWzIwMF1bMjAwXSxILFc7CmludCBzb2x2ZShpbnQgYXgsaW50IGF5LGludCBieCxpbnQgYnkpewoJaW50IG1heG49MDsKCWlmKGF4PEgtMSAmJiBieDxILTEpe2ludCBCPTA7aWYoYXghPWJ4IHx8IGF5IT1ieSl7Qj1hW2J4XVtieV07fW1heG49bWF4KG1heG4sc29sdmUoYXgrMSxheSxieCsxLGJ5KSthW2F4XVtheV0rQik7fQoJaWYoYXk8Vy0xICYmIGJ4PEgtMSl7aW50IEI9MDtpZihheCE9YnggfHwgYXkhPWJ5KXtCPWFbYnhdW2J5XTt9bWF4bj1tYXgobWF4bixzb2x2ZShheCxheSsxLGJ4KzEsYnkpK2FbYXhdW2F5XStCKTt9CglpZihheDxILTEgJiYgYnk8Vy0xKXtpbnQgQj0wO2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