#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  int a[n][n];
  int dp[2][n][n];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      for (int v = 0; v < 2; v++) dp[v][i][j] = -100000000;
  dp[1][0][0] = a[0][0];
  for (int k = 1; k <= n + n - 2; k++) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) dp[0][i][j] = dp[1][i][j];
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) dp[1][i][j] = -100000000;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        if (i == j) {
          if (i > 0 && j > 0)
            dp[1][i][j] = max(dp[1][i][j], dp[0][i - 1][j - 1] + a[i][k - i]);
          if (i < k && j < k)
            dp[1][i][j] = max(dp[1][i][j], dp[0][i][j] + a[i][k - i]);
          if (i > 0 && j < k)
            dp[1][i][j] = max(dp[1][i][j], dp[0][i - 1][j] + a[i][k - i]);
          if (i < k && j > 0)
            dp[1][i][j] = max(dp[1][i][j], dp[0][i][j - 1] + a[i][k - i]);
        } else {
          if (i > 0 && j > 0)
            dp[1][i][j] = max(dp[1][i][j],
                              dp[0][i - 1][j - 1] + a[i][k - i] + a[j][k - j]);
          if (i < k && j < k)
            dp[1][i][j] =
                max(dp[1][i][j], dp[0][i][j] + a[i][k - i] + a[j][k - j]);
          if (i > 0 && j < k)
            dp[1][i][j] =
                max(dp[1][i][j], dp[0][i - 1][j] + a[i][k - i] + a[j][k - j]);
          if (i < k && j > 0)
            dp[1][i][j] =
                max(dp[1][i][j], dp[0][i][j - 1] + a[i][k - i] + a[j][k - j]);
        }
  }
  cout << dp[1][n - 1][n - 1] << "\n";
}
