#include <bits/stdc++.h>
using namespace std;
template <typename T>
void fill_all(T &arr, const T &v) {
  arr = v;
}
template <typename T, typename ARR>
void fill_all(ARR &arr, const T &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
long long int h, w, grid[200][200], dp[500][200][200];
int main() {
  cin >> h >> w;
  for (long long int i = (signed)(0); i < (h); ++i) {
    for (long long int j = (signed)(0); j < (w); ++j) {
      cin >> grid[i][j];
    }
  }
  for (long long int i = (signed)(0); i < (h + w); ++i) {
    for (long long int X = (signed)(0); X < (w); ++X) {
      for (long long int x = i - X; x >= 0 && x < w;) {
        if (X == x) {
          dp[i + 1][X + 1][x] =
              max(dp[i + 1][X + 1][x], grid[i - X][X] + dp[i + 1][X][x]);
          dp[i + 1][X][x + 1] =
              max(dp[i + 1][X][x + 1], grid[i - X][X] + dp[i + 1][X][x]);
          dp[i + 1][X + 1][x + 1] =
              max(dp[i + 1][X + 1][x + 1], grid[i - X][X] + dp[i][X][x]);
          dp[i + 1][X][x] = max(dp[i + 1][X][x], grid[i - X][X] + dp[i][X][x]);
        } else {
          dp[i + 1][X + 1][x] =
              max(dp[i + 1][X + 1][x],
                  grid[i - X][X] + grid[i - x][x] + dp[i + 1][X][x]);
          dp[i + 1][X][x + 1] =
              max(dp[i + 1][X][x + 1],
                  grid[i - X][X] + grid[i - x][x] + dp[i + 1][X][x]);
          dp[i + 1][X + 1][x + 1] =
              max(dp[i + 1][X + 1][x + 1],
                  grid[i - X][X] + grid[i - x][x] + dp[i][X][x]);
          dp[i + 1][X][x] = max(dp[i + 1][X][x],
                                grid[i - X][X] + grid[i - x][x] + dp[i][X][x]);
        }
      }
    }
  }
  cout << dp[h + w][w][w] << endl;
}
