#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int mxN = 301;
int board[mxN][mxN];
int dp[mxN][mxN][mxN + 5];
int n;
bool inside(int x, int y) { return x >= 0 && x < n && y >= 0 && y < n; }
int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (n); ++j) {
      cin >> board[i][j];
      for (int k = (0); k < (mxN); ++k) {
        dp[i][j][k] = -INF;
      }
    }
  }
  dp[0][0][0] = board[0][0];
  for (int dist = (1); dist < (2 * n - 1); ++dist) {
    for (int i = (0); i < (dist + 1); ++i) {
      for (int diff = (0); diff < (mxN); ++diff) {
        int x1 = i;
        int y1 = dist - i;
        int x2 = i - diff;
        int y2 = dist - i + diff;
        if (!inside(x2, y2)) continue;
        if (!inside(x1, y1)) continue;
        if (inside(x1 - 1, y1)) {
          if (inside(x2, y2 - 1) && diff > 0) {
            dp[x1][y1][diff] = max(dp[x1][y1][diff], dp[x1 - 1][y1][diff - 1]);
          }
          if (inside(x2 - 1, y2)) {
            dp[x1][y1][diff] = max(dp[x1][y1][diff], dp[x1 - 1][y1][diff]);
          }
        }
        if (inside(x1, y1 - 1)) {
          if (inside(x2, y2 - 1)) {
            dp[x1][y1][diff] = max(dp[x1][y1][diff], dp[x1][y1 - 1][diff]);
          }
          if (inside(x2 - 1, y2)) {
            dp[x1][y1][diff] = max(dp[x1][y1][diff], dp[x1][y1 - 1][diff + 1]);
          }
        }
        if (diff > 0) {
          dp[x1][y1][diff] += board[x1][y1];
          dp[x1][y1][diff] += board[x2][y2];
        } else {
          dp[x1][y1][diff] += board[x1][y1];
        }
      }
    }
  }
  cout << dp[n - 1][n - 1][0] << "\n";
  return 0;
}
