#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const long long MOD = 1000000000 + 7;
constexpr long long INF = 1LL << 60;
const double PI = acos(-1);
struct Tll {
  LL first, second, third;
};
struct Fll {
  LL first, second, third, fourth;
};
void YN(bool f) {
  if (f)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
void yn(bool f) {
  if (f)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
struct Edge {
  LL to, cost;
};
struct edge {
  LL from, to, cost;
};
vector<vector<Edge>> g;
vector<edge> ed;
vector<pair<LL, LL>> pv;
set<LL> st;
map<pair<LL, LL>, LL> ma;
int di[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
string str, ss;
bool f;
LL n, m, s, t, h, w, k, q, p, ans, sum, cnt, a[300][300], b[21],
    dp[200][200][400];
int main() {
  cin >> h >> w;
  g.resize(h * w);
  for (LL i = 0; i < h; i++) {
    for (LL j = 0; j < w; j++) {
      cin >> a[i][j];
    }
  }
  dp[0][0][0] = a[0][0];
  for (LL st = 0; st < h + w - 1; st++) {
    for (LL sx = 0; sx < h; sx++) {
      for (LL tx = 0; tx < h; tx++) {
        LL sy = st - sx, ty = st - tx;
        if (dp[st + 1][sx][tx] <
            dp[st][sx][tx] + (sx == tx
                                  ? a[sx][st - sx + 1]
                                  : a[sx][st - sx + 1] + a[tx][st - tx + 1])) {
          dp[st + 1][sx][tx] =
              dp[st][sx][tx] + (sx == tx
                                    ? a[sx][st - sx + 1]
                                    : a[sx][st - sx + 1] + a[tx][st - tx + 1]);
        }
        if (sx + 1 < h) {
          if (dp[st + 1][sx + 1][tx] <
              dp[st][sx][tx] +
                  (sx + 1 == tx ? a[sx + 1][st - sx]
                                : a[sx + 1][st - sx] + a[tx][st - tx + 1])) {
            dp[st + 1][sx + 1][tx] =
                dp[st][sx][tx] +
                (sx + 1 == tx ? a[sx + 1][st - sx]
                              : a[sx + 1][st - sx] + a[tx][st - tx + 1]);
          }
        }
        if (tx + 1 < h) {
          if (dp[st + 1][sx][tx + 1] <
              dp[st][sx][tx] +
                  (sx == tx + 1 ? a[sx][st - sx + 1]
                                : a[sx][st - sx + 1] + a[tx + 1][st - tx])) {
            dp[st + 1][sx][tx + 1] =
                dp[st][sx][tx] +
                (sx == tx + 1 ? a[sx][st - sx + 1]
                              : a[sx][st - sx + 1] + a[tx + 1][st - tx]);
          }
        }
        if (tx + 1 < h && sx + 1 < h) {
          if (dp[st + 1][sx + 1][tx + 1] <
              dp[st][sx][tx] + (sx + 1 == tx + 1 ? a[sx + 1][st - sx]
                                                 : a[sx + 1][st - sx] +
                                                       a[tx + 1][st - tx])) {
            dp[st + 1][sx + 1][tx + 1] =
                dp[st][sx][tx] +
                (sx + 1 == tx + 1 ? a[sx + 1][st - sx]
                                  : a[sx + 1][st - sx] + a[tx + 1][st - tx]);
          }
        }
      }
    }
  }
  cout << dp[h + w - 2][h - 1][h - 1] << endl;
  return 0;
}
