#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
long long H, W;
long long A[222][222];
long long dp[222][222][222];
signed main() {
  cin >> H >> W;
  for (long long i = 0; i < (H); i++)
    for (long long j = 0; j < (W); j++) cin >> A[i][j];
  for (long long i = 0; i < H + W - 2; i++) {
    for (long long j = 0; j <= i && j < W; j++) {
      for (long long k = 0; k <= i && k < W; k++) {
        long long x1 = j, y1 = i - j;
        long long x2 = k, y2 = i - k;
        for (long long b = 0; b < (4); b++) {
          long long nx1 = x1, ny1 = y1;
          long long nx2 = x2, ny2 = y2;
          if (b & 1)
            nx1++;
          else
            ny1++;
          if (b >> 1 & 1)
            nx2++;
          else
            ny2++;
          if (nx1 >= W || ny1 >= H || nx2 >= W || ny2 >= H) continue;
          if (nx1 != nx2 || ny1 != ny2)
            chmax(dp[i + 1][nx1][nx2], dp[i][j][k] + A[ny1][nx1] + A[ny2][nx2]);
          else
            chmax(dp[i + 1][nx1][nx2], dp[i][j][k] + A[ny1][nx1]);
        }
      }
    }
  }
  cout << dp[H + W - 2][W - 1][W - 1] + A[0][0] << endl;
  return 0;
}
