#include <bits/stdc++.h>
using namespace std;
int a[308][308], f[308][308][308];
void up(int &x, int y) {
  if (x < y) x = y;
}
int main() {
  int n;
  cin >> n;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++) cin >> a[i][j];
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++)
      for (int k = (1); k <= (n); k++) f[i][j][k] = -1 << 29;
  f[1][1][1] = 0;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++)
      for (int k = (1); k <= (n); k++) {
        int l = i + j - k;
        if (l > n || l < 1) continue;
        f[i][j][k] += a[i][j] + a[k][l];
        if (i == k && j == l) f[i][j][k] -= a[i][j];
        for (int p1 = (0); p1 <= (1); p1++)
          for (int p2 = (0); p2 <= (1); p2++)
            up(f[i + p1][j + 1 - p1][k + p2], f[i][j][k]);
      }
  cout << f[n][n][n];
  return 0;
}
