#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e14;
const double eps = 1e-10;
const double pi = acos(-1.0);
int a[305][610];
int dp[305][305][610];
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      scanf("%d", &a[i][j + i]);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 0; k <= n + n; k++) {
        dp[i][j][k] = -1e9;
      }
    }
  }
  dp[1][1][2] = a[1][2];
  for (int d = 2; d <= n + n - 1; d++) {
    for (int i = 1; i <= min(d + 1, n); i++) {
      for (int j = 1; j <= min(d + 1, n); j++) {
        int tx = i + 1;
        int ty = j;
        int& res = dp[tx][ty][d + 1];
        if (tx == ty)
          res = max(res, dp[i][j][d] + a[tx][d + 1]);
        else
          res = max(res, dp[i][j][d] + a[tx][d + 1] + a[ty][d + 1]);
        tx = i + 1;
        ty = j + 1;
        int& res1 = dp[tx][ty][d + 1];
        if (tx == ty)
          res1 = max(res1, dp[i][j][d] + a[tx][d + 1]);
        else
          res1 = max(res1, dp[i][j][d] + a[tx][d + 1] + a[ty][d + 1]);
        tx = i;
        ty = j;
        int& res2 = dp[tx][ty][d + 1];
        if (tx == ty)
          res2 = max(res2, dp[i][j][d] + a[tx][d + 1]);
        else
          res2 = max(res2, dp[i][j][d] + a[tx][d + 1] + a[ty][d + 1]);
        tx = i;
        ty = j + 1;
        int& res3 = dp[tx][ty][d + 1];
        if (tx == ty)
          res3 = max(res3, dp[i][j][d] + a[tx][d + 1]);
        else
          res3 = max(res3, dp[i][j][d] + a[tx][d + 1] + a[ty][d + 1]);
      }
    }
  }
  cout << dp[n][n][n + n] << endl;
  return 0;
}
