#include <bits/stdc++.h>
using namespace std;
int f[305][305][305];
int p[305][305];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) scanf("%d", &p[i][j]);
  f[0][0][0] = p[0][0];
  for (int x1 = 0; x1 < n; x1++)
    for (int y1 = 0; y1 < n; y1++)
      if (x1 + y1 != 0)
        for (int x2 = 0; x2 < n; x2++) {
          f[x1][y1][x2] = -1 << 30;
          int y2 = x1 + y1 - x2;
          int add;
          if (x1 == x2 && y1 == y2)
            add = p[x1][y1];
          else
            add = p[x1][y1] + p[x2][y2];
          if (x1 - 1 >= 0 && x2 - 1 >= 0) {
            f[x1][y1][x2] = max(f[x1][y1][x2], f[x1 - 1][y1][x2 - 1] + add);
          }
          if (x1 - 1 >= 0 && y2 - 1 >= 0) {
            f[x1][y1][x2] = max(f[x1][y1][x2], f[x1 - 1][y1][x2] + add);
          }
          if (y1 - 1 >= 0 && x2 - 1 >= 0) {
            f[x1][y1][x2] = max(f[x1][y1][x2], f[x1][y1 - 1][x2 - 1] + add);
          }
          if (y1 - 1 >= 0 && y2 - 1 >= 0) {
            f[x1][y1][x2] = max(f[x1][y1][x2], f[x1][y1 - 1][x2] + add);
          }
        }
  printf("%d\n", f[n - 1][n - 1][n - 1]);
}
