#include <bits/stdc++.h>
using namespace std;
const int inf = 2100000000;
const int maxn = 310;
int a[maxn][maxn];
int dp[maxn][maxn][maxn + maxn];
int main() {
  int n, i, j, k;
  while (~scanf("%d", &n)) {
    for (i = 1; i <= n; i++)
      for (j = 1; j <= n; j++) scanf("%d", &a[i][j]);
    for (k = 0; k <= n + n; k++)
      for (i = 0; i <= min(n, k - 1) + 5; i++)
        for (j = 0; j <= min(n, k - 1) + 5; j++) dp[i][j][k] = -inf;
    for (i = 0; i <= 2; i++)
      for (j = 0; j <= 2; j++) dp[i][j][1] = 0;
    for (k = 2; k <= n + n; k++)
      for (i = 1; i <= min(n, k - 1); i++)
        for (j = 1; j <= min(n, k - 1); j++) {
          int maxd = dp[i][j][k - 1];
          if (dp[i - 1][j][k - 1] > maxd) maxd = dp[i - 1][j][k - 1];
          if (dp[i][j - 1][k - 1] > maxd) maxd = dp[i][j - 1][k - 1];
          if (dp[i - 1][j - 1][k - 1] > maxd) maxd = dp[i - 1][j - 1][k - 1];
          if (i == j)
            dp[i][j][k] = maxd + a[i][k - i];
          else
            dp[i][j][k] = maxd + a[i][k - i] + a[j][k - j];
        }
    printf("%d\n", dp[n][n][n + n]);
  }
  getchar();
  getchar();
  return 0;
}
