#include <bits/stdc++.h>
using namespace std;
int Map[305][305], F[305 << 1][305][305];
int X[4] = {-1, -1, 0, 0};
int Y[4] = {-1, 0, -1, 0};
int main() {
  int i, j, k, n, t;
  memset(F, 0xCC, sizeof(F));
  for (i = scanf("%d", &n); i <= n; i++)
    for (j = 1; j <= n; j++) scanf("%d", &Map[i][j]);
  for (F[0][i = 1][1] = Map[1][1]; i <= 2 * n - 2; i++)
    for (j = 1; j <= n && j <= i + 1; j++)
      for (k = j; k <= n && k <= i + 1; k++) {
        for (t = 0; t < 4; t++)
          F[i][j][k] = max(F[i][j][k], F[i - 1][j + X[t]][k + Y[t]]);
        F[i][j][k] += Map[j][i - j + 2] + Map[k][i - k + 2] -
                      (j == k ? Map[k][i - k + 2] : 0);
      }
  printf("%d\n", F[2 * n - 2][n][n]);
  return 0;
}
