#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-8;
const long double PI = 3.1415926535897932384626433832795;
const long double E = 2.7182818284;
const int INF = 1000000000;
int main(void) {
  int n, i, j, g;
  cin >> n;
  int a[n][n];
  for (int i = 0; i < int(n); i++)
    for (int j = 0; j < int(n); j++) cin >> a[i][j];
  int dp[2][n][n];
  for (int i = 0; i < int(2); i++)
    for (int j = 0; j < int(n); j++)
      for (int g = 0; g < int(n); g++) dp[i][j][g] = -INF;
  dp[0][0][0] = a[0][0];
  for (i = 1; i < 2 * n - 1; i++) {
    for (int j = 0; j < int(min(n, i + 1)); j++) {
      for (int g = 0; g < int(min(n, i + 1)); g++) {
        int ind1 = i & 1, ind2 = (ind1 + 1) & 1;
        if (i - g >= n || i - j >= n) continue;
        int k = a[i - g][g] + a[i - j][j];
        if (j == g) k -= a[i - g][g];
        dp[ind1][j][g] = dp[ind2][j][g] + k;
        if (j) {
          dp[ind1][j][g] = max(dp[ind1][j][g], dp[ind2][j - 1][g] + k);
        }
        if (g) {
          dp[ind1][j][g] = max(dp[ind1][j][g], dp[ind2][j][g - 1] + k);
        }
        if (j && g)
          dp[ind1][j][g] = max(dp[ind1][j][g], dp[ind2][j - 1][g - 1] + k);
      }
    }
  }
  cout << dp[0][n - 1][n - 1];
  return 0;
}
