#include <bits/stdc++.h>
using namespace std;
int h, w, t, ans1, ans2;
int omap[210][210];
int flag[210][210];
int tflag[210][210];
void tdfs(int x, int y, int tt, int tans) {
  if (x > h || y > w) return;
  if (tt > t) return;
  if (x == h && y == w) {
    if (tans > ans2) {
      ans2 = tans;
    }
  }
  int add;
  tflag[x + 1][y] = 1;
  if (flag[x + 1][y])
    add = 0;
  else
    add = omap[x + 1][y];
  tdfs(x + 1, y, tt + 1, tans + add);
  tflag[x + 1][y] = 0;
  tflag[x][y + 1] = 1;
  if (flag[x][y + 1])
    add = 0;
  else
    add = omap[x][y + 1];
  tdfs(x, y + 1, tt + 1, tans + add);
  tflag[x][y + 1] = 0;
}
void dfs(int x, int y, int tt, int tans) {
  if (x > h || y > w) return;
  if (tt > t) return;
  if (x == h && y == w) {
    if (tans > ans1) {
      ans1 = tans;
      memset(tflag, 0, sizeof(tflag));
      tflag[1][1] = 1;
      tdfs(1, 1, 0, 0);
    }
  }
  flag[x + 1][y] = 1;
  dfs(x + 1, y, tt + 1, tans + omap[x + 1][y]);
  flag[x + 1][y] = 0;
  flag[x][y + 1] = 1;
  dfs(x, y + 1, tt + 1, tans + omap[x][y + 1]);
  flag[x][y + 1] = 0;
}
int main() {
  while (~scanf("%d %d", &h, &w)) {
    ans1 = 0;
    ans2 = 0;
    memset(flag, 0, sizeof(flag));
    for (int i = 1; i <= h; i++) {
      for (int j = 1; j <= w; j++) {
        scanf("%d", &omap[i][j]);
      }
    }
    t = h + w - 2;
    flag[1][1] = 1;
    dfs(1, 1, 0, omap[1][1]);
    printf("%d\n", ans1 + ans2);
  }
  return 0;
}
