#include <bits/stdc++.h>
using namespace std;
int f[2 * 301][301][301];
int a[301][301];
int main() {
  int total;
  int n;
  scanf("%d", &n);
  for (int i = 0, _n = n; i < _n; i++)
    for (int j = 0, _n = n; j < _n; j++) scanf("%d", &a[i][j]);
  total = 2 * n - 1;
  for (int i = 0, _b = total; i <= _b; i++)
    for (int j = 0, _n = n; j < _n; j++)
      for (int k = 0, _n = n; k < _n; k++) f[i][j][k] = -(int)1e9;
  f[0][0][0] = a[0][0];
  for (int step = 0, _b = total; step <= _b; step++)
    for (int ya = 0, _n = n; ya < _n; ya++)
      for (int yb = ya, _b = n - 1; yb <= _b; yb++) {
        int xa = step - ya;
        int xb = step - yb;
        if (xa < 0 || xb < 0 || f[step][ya][yb] == -(int)1e9) continue;
        if (ya + 1 < n && yb + 1 < n) {
          int tmp = f[step][ya][yb] + a[xa][ya + 1];
          if (xa != xb && ya != yb) tmp += a[xb][yb + 1];
          f[step + 1][ya + 1][yb + 1] = max(f[step + 1][ya + 1][yb + 1], tmp);
        }
        if (xa + 1 < n && xb + 1 < n) {
          int tmp = f[step][ya][yb] + a[xa + 1][ya];
          if (xa != xb && ya != yb) tmp += a[xb + 1][yb];
          f[step + 1][ya][yb] = max(f[step + 1][ya][yb], tmp);
        }
        if (xa + 1 < n && yb + 1 < n) {
          int tmp = f[step][ya][yb] + a[xa + 1][ya];
          if (xa + 1 != xb && ya != yb + 1) tmp += a[xb][yb + 1];
          f[step + 1][ya][yb + 1] = max(f[step + 1][ya][yb + 1], tmp);
        }
        if (ya + 1 < n && xb + 1 < n) {
          int tmp = f[step][ya][yb] + a[xa][ya + 1];
          if (xa != xb + 1 && ya + 1 != yb) tmp += a[xb + 1][yb];
          f[step + 1][ya + 1][yb] = max(f[step + 1][ya + 1][yb], tmp);
        }
      }
  cout << f[total - 1][n - 1][n - 1] << endl;
  return 0;
}
