#include <bits/stdc++.h>
using namespace std;
const int dir[2][4] = {{-1, -1, 0, 0}, {-1, 0, -1, 0}};
int F[602][301][301], a[301][301];
int n, m;
int main() {
  scanf("%d", &n);
  m = n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &a[i][j]);
  for (int k = 0; k <= m + n; k++)
    for (int i = 0; i <= n; i++)
      for (int j = 0; j <= m; j++) F[k][i][j] = -2100000000;
  F[0][0][0] = 0;
  F[0][0][1] = 0;
  F[0][1][0] = 0;
  F[1][0][0] = 0;
  F[1][0][1] = 0;
  F[1][1][0] = 0;
  int x;
  for (int k = 2; k <= n + m; k++)
    for (int i1 = 1; i1 <= min(n, k - 1); i1++)
      for (int i2 = 1; i2 <= min(n, k - 1); i2++) {
        x = a[i1][k - i1] + a[i2][k - i2];
        if (i1 == i2) x = a[i1][k - i1];
        for (int i = 0; i <= 3; i++)
          F[k][i1][i2] =
              max(F[k][i1][i2], F[k - 1][i1 + dir[0][i]][i2 + dir[1][i]]);
        F[k][i1][i2] += x;
      }
  printf("%d\n", F[n + m][n][n]);
  return 0;
}
