#include <bits/stdc++.h>
using namespace std;
template <class T>
using vv = vector<vector<T>>;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
  os << "{";
  for (int(i) = 0; (i) < (t.size()); ++(i)) {
    os << t[i] << ",";
  }
  os << "}" << endl;
  return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
  return os << "(" << t.first << "," << t.second << ")";
}
template <class T>
inline bool MX(T &l, const T &r) {
  return l < r ? l = r, 1 : 0;
}
template <class T>
inline bool MN(T &l, const T &r) {
  return l > r ? l = r, 1 : 0;
}
const long long MOD = 1e9 + 7;
const long long INF = 1e13;
long long a[222][222];
long long dp[422][222][222];
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(0);
  int n, m;
  cin >> n >> m;
  for (int(i) = 0; (i) < (n); ++(i))
    for (int(j) = 0; (j) < (m); ++(j)) cin >> a[i][j];
  fill(dp[0][0], dp[0][0] + 222 * 222 * 222, -INF);
  dp[0][0][0] = 0;
  for (int(i) = 0; (i) < (n + m); ++(i))
    for (int(j) = 0; (j) < (m); ++(j))
      for (int(k) = 0; (k) < (j + 1); ++(k)) {
        if (i - j >= 0) {
          dp[i][j][k] += a[i - j][j];
          if (j != k) dp[i][j][k] += a[i - k][k];
        }
        for (int(a) = 0; (a) < (2); ++(a))
          for (int(b) = 0; (b) < (2); ++(b))
            MX(dp[i + 1][j + a][k + b], dp[i][j][k]);
      }
  cout << dp[n + m - 2][m - 1][m - 1] << endl;
  return 0;
}
