#include <bits/stdc++.h>
using namespace std;
const int N = 302;
int f[2][N][N];
int a[N][N];
const int Dir[4][2] = {{0, 0}, {-1, 0}, {-1, -1}, {0, -1}};
int main() {
  int i, j, x1, x2, x1p, x2p, k, n;
  int xs, xe;
  cin >> n;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++) scanf("%d", &a[i][j]);
  f[0][0][0] = a[0][0];
  for (k = 1; k <= n + n - 2; k++) {
    xs = max(k - n + 1, 0);
    xe = min(k, n - 1);
    for (x1 = xs; x1 <= xe; x1++)
      for (x2 = xs; x2 <= xe; x2++) {
        int tmp = -100000000;
        for (i = 0; i < 4; i++) {
          x1p = x1 + Dir[i][0];
          x2p = x2 + Dir[i][1];
          if (x1p >= 0 and x2p >= 0 and x1p <= k - 1 and x2p <= k - 1) {
            tmp = max(f[(k - 1) % 2][x1p][x2p], tmp);
          }
        }
        f[k % 2][x1][x2] = tmp + a[k - x1][x1] + (x1 != x2) * a[k - x2][x2];
      }
  }
  cout << f[0][n - 1][n - 1] << endl;
  return 0;
}
