#include <bits/stdc++.h>
using namespace std;
int A[301][301], DP[301][301][602];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> A[i][j];
  memset(DP, 128, sizeof DP);
  DP[1][1][1] = A[1][1];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      for (int k = 1; k <= n; k++) {
        if (k == 1 and j == 1 and i == 1) continue;
        int p = i + j - k;
        if (p > n or p < 1) continue;
        DP[i][j][k] = max(
            DP[i - 1][j][k - 1],
            max(DP[i][j - 1][k - 1], max(DP[i - 1][j][k], DP[i][j - 1][k])));
        if (i == k or j == p)
          DP[i][j][k] += A[i][j];
        else
          DP[i][j][k] += A[i][j] + A[k][p];
      }
  cout << DP[n][n][n] << '\n';
}
