#include <bits/stdc++.h>
using namespace std;
int h, w;
int g[222][222];
long long dp[444][222][222];
long long dfs(int d, int x1, int x2) {
  int y1 = d - x1, y2 = d - x2;
  if ((x1 < 0 || x1 >= w || y1 < 0 || y1 >= h) ||
      (x2 < 0 || x2 >= w || y2 < 0 || y2 >= h))
    return -1e15;
  if (dp[d][x1][x2] != -1) return dp[d][x1][x2];
  if (d == h + w - 2) return g[x1][x2];
  long long res = -1e15;
  res = max(res, dfs(d + 1, x1, x2));
  res = max(res, dfs(d + 1, x1 + 1, x2));
  res = max(res, dfs(d + 1, x1, x2 + 1));
  res = max(res, dfs(d + 1, x1 + 1, x2 + 1));
  res += g[y1][x1];
  res += g[y2][x2];
  if (x1 == x2) res -= g[y1][x1];
  return dp[d][x1][x2] = res;
}
int main() {
  cin.sync_with_stdio(false);
  cin >> h >> w;
  for (int i = (int)(0); i < (int)(h); i++)
    for (int j = (int)(0); j < (int)(w); j++) cin >> g[i][j];
  memset(dp, -1, sizeof(dp));
  cout << dfs(0, 0, 0) << endl;
  return 0;
}
