#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <chrono>
#include <random>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX_H = 210;
const int MAX_W = 210;
using State = pair<LL, PII>; // <score, (h, w)>
int H, W;
VVI a;

int dp[MAX_H][MAX_W][MAX_H][MAX_W];

int main(void) {
    scanf("%d%d", &H, &W);
    a.resize(H, VI(W));
    for_each(ALL(a), [](auto &v) {
        for_each(ALL(v), [](int &e){scanf("%d", &e);});
    });
    assert(H <= 30 && W <= 30);
    dp[0][0][0][0] = a[0][0];
    REP(eh, H) REP(ew, W) REP(sh, H) REP(sw, W) {
        if (eh == 0 && ew == 0 && sh == 0 && sw == 0) continue;
        LL buf = 0;
        if (eh && sh) buf = max(buf, dp[eh - 1][ew][sh - 1][sw]);
        if (eh && sw) buf = max(buf, dp[eh - 1][ew][sh][sw - 1]);
        if (ew && sw) buf = max(buf, dp[eh][ew - 1][sh][sw - 1]);
        if (ew && sh) buf = max(buf, dp[eh][ew - 1][sh - 1][sw]);
        if (eh == sh && ew == sw) dp[eh][ew][sh][sw] = buf + a[sh][sw];
        else dp[eh][ew][sh][sw] = buf + a[eh][ew] + a[sh][sw];
    }
    cout << dp[H - 1][W - 1][H - 1][W - 1] << endl;
}
