#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

int dp[205][205][205][205];
int H, W;
int a[205][205];

int main(){
	cin >> H >> W;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> a[i][j];
		}
	}
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			for(int k = 0; k < H; k++){
				for(int l = 0; l < W; l++){
					dp[i][j][k][l] = - INT_MAX;
				}
			}
		}
	}


	dp[0][0][0][0] = 0;

	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			for(int k = 0; k < H; k++){
				for(int l = 0; l < W; l++){
					if(i == k && j == l){
						if(i != H - 1){
							if(k != H - 1){
								dp[i+1][j][k+1][l] = max(dp[i+1][j][k+1][l], dp[i][j][k][l] + a[i][j]);
							}
							if(l != W - 1){
								dp[i+1][j][k][l+1] = max(dp[i+1][j][k][l+1], dp[i][j][k][l] + a[i][j]);
							}
						}
						if(j != W - 1){
							if(k != H - 1){
								dp[i][j+1][k+1][l] = max(dp[i][j+1][k+1][l], dp[i][j][k][l] + a[i][j]);
							}
							if(l != W - 1){
								dp[i][j+1][k][l+1] = max(dp[i][j+1][k][l+1], dp[i][j][k][l] + a[i][j]);
							}
						}

					}else{
						if(i != H - 1){
							if(k != H - 1){
								dp[i+1][j][k+1][l] = max(dp[i+1][j][k+1][l], dp[i][j][k][l] + a[i][j] + a[k][l]);
							}
							if(l != W - 1){
								dp[i+1][j][k][l+1] = max(dp[i+1][j][k][l+1], dp[i][j][k][l] + a[i][j] + a[k][l]);
							}
						}
						if(j != W - 1){
							if(k != H - 1){
								dp[i][j+1][k+1][l] = max(dp[i][j+1][k+1][l], dp[i][j][k][l] + a[i][j] + a[k][l]);
							}
							if(l != W - 1){
								dp[i][j+1][k][l+1] = max(dp[i][j+1][k][l+1], dp[i][j][k][l] + a[i][j] + a[k][l]);
							}
						}
					}
				}
			}
		}
	}


	cout << dp[H-1][W-1][H-1][W-1] + a[H-1][W-1] << endl;





}
