#include <bits/stdc++.h>
using namespace std;
int n;
int a[303 + 303][303];
int d[303 + 303][303][303];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) scanf("%d", &a[i + j][j]);
  for (int diag = 0; diag < n + n - 1; ++diag)
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) d[diag][i][j] = -1000000000;
  d[0][0][0] = a[0][0];
  for (int diag = 0; diag < n + n - 2; ++diag)
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j)
        for (int di = 0; di < 2; ++di)
          for (int dj = 0; dj < 2; ++dj) {
            int si = i + di;
            int sj = j + dj;
            d[diag + 1][si][sj] =
                max(d[diag + 1][si][sj],
                    d[diag][i][j] +
                        (si == sj ? a[diag + 1][si]
                                  : (a[diag + 1][si] + a[diag + 1][sj])));
          }
  cout << d[n + n - 2][n - 1][n - 1] << endl;
  return 0;
}
