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