#include <bits/stdc++.h>
using namespace std;
int n, a[305][305], f[605][305][305];
int main() {
  scanf("%d", &n);
  memset(f, 0xcf, sizeof f);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) scanf("%d", &a[i][j]);
  int up = n + n - 2, hc;
  f[0][1][1] = a[1][1];
  for (int i = 1; i <= up; ++i) {
    for (int jj, j = 1; j <= n; ++j) {
      jj = i + 2 - j;
      if (jj < 1 || jj > n) continue;
      for (int kk, k = 1; k <= n; ++k) {
        kk = i + 2 - k;
        if (kk < 1 || kk > n) continue;
        if (j == k && jj == kk)
          hc = a[j][jj];
        else
          hc = a[j][jj] + a[k][kk];
        hc +=
            max(f[i - 1][j - 1][k], max(max(f[i - 1][j][k], f[i - 1][j][k - 1]),
                                        f[i - 1][j - 1][k - 1]));
        f[i][j][k] = hc;
      }
    }
  }
  printf("%d", f[up][n][n]);
  return 0;
}
