#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<int> > v, dp;
int main() {
  scanf("%d", &n);
  v.resize(n + 1, vector<int>(n + 1, 0));
  dp.resize(n + 1, vector<int>(n + 1, -1000000007));
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) scanf("%d", &v[i][j]);
  }
  dp[1][1] = v[1][1];
  for (int x = 3; x <= 2 * n; ++x) {
    for (int i = min(x - 1, n); x - i <= n && i > 0; --i) {
      for (int j = min(x - 1, n); j >= i && x - j <= n; --j) {
        int c = v[x - i][i], d = v[x - j][j];
        if (i == j)
          dp[i][j] = max(dp[i][j], max(dp[i - 1][j - 1], dp[i - 1][j])) + c;
        else
          dp[i][j] = max(dp[i][j], max(dp[i - 1][j - 1],
                                       max(dp[i][j - 1], dp[i - 1][j]))) +
                     c + d;
      }
    }
  }
  printf("%d", dp[n][n]);
  return 0;
}
