#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 - 1); ++i) {
    for (long long int X = (signed)(0); X < (min(w, i)); ++X) {
      for (long long int x = (signed)(0); x < (min(w, i)); ++x) {
        if (h <= i - X || h <= i - x) continue;
        long long int y = i - X, Y = i - x;
        if (X == x) {
          dp[i + 1][X + 1][x] =
              max(dp[i + 1][X + 1][x], grid[Y][X] + dp[i][X][x]);
          dp[i + 1][X][x + 1] =
              max(dp[i + 1][X][x + 1], grid[Y][X] + dp[i][X][x]);
          dp[i + 1][X + 1][x + 1] =
              max(dp[i + 1][X + 1][x + 1], grid[Y][X] + dp[i][X][x]);
          dp[i + 1][X][x] = max(dp[i + 1][X][x], grid[Y][X] + dp[i][X][x]);
        } else {
          dp[i + 1][X + 1][x] = max(dp[i + 1][X + 1][x],
                                    grid[i - X][X] + grid[y][x] + dp[i][X][x]);
          dp[i + 1][X][x + 1] =
              max(dp[i + 1][X][x + 1], grid[Y][X] + grid[y][x] + dp[i][X][x]);
          dp[i + 1][X + 1][x + 1] = max(dp[i + 1][X + 1][x + 1],
                                        grid[Y][X] + grid[y][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 - 2][w - 1][w - 1] + grid[h - 1][w - 1] << endl;
}
