#include <bits/stdc++.h>
using namespace std;
int n;
const int MAXN = 3e2 + 10;
const int INF = 1e7;
int a[MAXN][MAXN];
int dp[MAXN << 1][MAXN][MAXN];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cin >> a[i][j];
    }
  }
  for (int t = 0; t <= n + n; ++t) {
    for (int i = 0; i <= n; ++i) {
      for (int j = 0; j <= n; ++j) {
        dp[t][i][j] = -INF;
      }
    }
  }
  dp[2][1][1] = a[1][1];
  for (int t = 3; t <= n + n; ++t) {
    for (int x1 = 1; x1 <= n; ++x1) {
      for (int x2 = 1; x2 <= n; ++x2) {
        int y1 = t - x1;
        int y2 = t - x2;
        int tt = max(max(dp[t - 1][x1 - 1][x2 - 1], dp[t - 1][x1][x2]),
                     max(dp[t - 1][x1][x2 - 1], dp[t - 1][x1 - 1][x2]));
        if (x1 == x2) {
          dp[t][x1][x2] = tt + a[x1][y1];
        } else {
          dp[t][x1][x2] = tt + a[x1][y1] + a[x2][y2];
        }
      }
    }
  }
  cout << dp[n + n][n][n] << endl;
  return 0;
}
