#include <bits/stdc++.h>
using namespace std;
int n, a[333][333], f[2][333][333], l[666], r[666];
int main() {
  int z = 0;
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) scanf("%d", a[i] + j);
  for (int j = 0; j < n; j++)
    for (int k = 0; k < n; k++) f[0][j][k] = -1000111222;
  f[0][0][0] = a[0][0];
  for (int i = 0; i <= n * 2 - 2; i++) {
    l[i] = i < n ? 0 : i - n + 1;
    r[i] = i < n ? i : n - 1;
  }
  for (int i = 0; i <= n * 2 - 3; i++) {
    z ^= 1;
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++) f[z][j][k] = -1000111222;
    for (int j = l[i]; j <= r[i]; j++)
      for (int k = j; k <= r[i]; k++)
        if (f[1 - z][j][k] > -1000111222)
          for (int jj = j; jj <= j + 1; jj++)
            if (jj >= l[i + 1] && jj <= r[i + 1])
              for (int kk = k; kk <= k + 1; kk++)
                if (kk >= l[i + 1] && kk <= r[i + 1]) {
                  int add = a[jj][i + 1 - jj] + a[kk][i + 1 - kk];
                  if (jj == kk) add /= 2;
                  f[z][jj][kk] = max(f[z][jj][kk], f[1 - z][j][k] + add);
                }
  }
  cout << f[z][n - 1][n - 1] << endl;
}
