#include <bits/stdc++.h>
using namespace std;
int a[307][307];
int f[607][307][307];
int moves[][4] = {{1, 0, 1, 0}, {1, 0, 0, 1}, {0, 1, 1, 0}, {0, 1, 0, 1}};
int main() {
  int n;
  cin >> n;
  for (int(i) = (int)(0); (i) < (int)(n); ++(i))
    for (int(j) = (int)(0); (j) < (int)(n); ++(j)) cin >> a[i][j];
  fill(&f[0][0][0], &f[0][0][0] + sizeof(f) / sizeof(f[0][0][0]), -987654321);
  f[0][0][0] = a[0][0];
  for (int d = 0; d < 2 * n - 1; ++d)
    for (int i1 = 0; i1 <= min(n - 1, d); ++i1)
      for (int i2 = 0; i2 <= min(n - 1, d); ++i2) {
        int j1 = d - i1, j2 = d - i2;
        for (int k = 0; k < 4; ++k) {
          int ii1 = i1 + moves[k][0], jj1 = j1 + moves[k][1];
          int ii2 = i2 + moves[k][2], jj2 = j2 + moves[k][3];
          if (!(0 <= ii1 && ii1 < n && 0 <= jj1 && jj1 < n && 0 <= ii2 &&
                ii2 < n && 0 <= jj2 && jj2 < n))
            continue;
          f[d + 1][ii1][ii2] =
              max(f[d + 1][ii1][ii2],
                  f[d][i1][i2] + a[ii1][jj1] +
                      (ii1 != ii2 || jj1 != jj2 ? a[ii2][jj2] : 0));
        }
      }
  cout << f[2 * n - 2][n - 1][n - 1] << endl;
  return 0;
}
