#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
const int N = 305, inf = 1e9;
int a[N][N], dp[2 * N][N][N];
void maxs(int &x, int y) { x = max(x, y); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
      for (int k = 0; k < 2 * n; k++) {
        dp[k][i][j] = -inf;
      }
    }
  }
  dp[0][0][0] = a[0][0];
  for (int i = 0; i < 2 * n; i++) {
    for (int x = 0; x < n; x++) {
      for (int p = 0; p < n; p++) {
        int y = i - x, q = i - p;
        if (not(y >= 0 and y < n and q >= 0 and q < n)) continue;
        maxs(dp[i + 1][x][p],
             dp[i][x][p] + a[x][y + 1] +
                 a[p][q + 1] * (not(x == p and y + 1 == q + 1)));
        maxs(dp[i + 1][x + 1][p],
             dp[i][x][p] + a[x + 1][y] +
                 a[p][q + 1] * (not(x + 1 == p and y == q + 1)));
        maxs(dp[i + 1][x][p + 1],
             dp[i][x][p] + a[x][y + 1] +
                 a[p + 1][q] * (not(x == p + 1 and y + 1 == q)));
        maxs(dp[i + 1][x + 1][p + 1],
             dp[i][x][p] + a[x + 1][y] +
                 a[p + 1][q] * (not(x + 1 == p + 1 and y == q)));
      }
    }
  }
  cout << dp[2 * n - 2][n - 1][n - 1];
}
