#include <bits/stdc++.h>
using namespace std;
int n, b[500][500], dp[400][400][400];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%d", &b[i][j]);
  dp[1][1][1] = b[1][1];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      for (int k = 1; k <= n; k++)
        if ((i != 1 || j != 1) && i + j - k <= n) {
          dp[i][j][k] = -100000000;
          if (i - 1 > 0 && k - 1 > 0 && i + j - k > 0 && i + j - k <= n)
            dp[i][j][k] = max(dp[i - 1][j][k - 1], dp[i][j][k]);
          if (j - 1 > 0 && i + j - 1 - k > 0 && i + j - 1 - k <= n)
            dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k]);
          if (i - 1 > 0 && i + j - 1 - k > 0 && i + j - 1 - k <= n)
            dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j][k]);
          if (j - 1 > 0 && k - 1 > 0 && i + j - k > 0 && i + j - k <= n)
            dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k - 1]);
          if (i != k)
            dp[i][j][k] += b[i][j] + b[k][i + j - k];
          else
            dp[i][j][k] += b[i][j];
        }
  printf("%d", dp[n][n][n]);
  return 0;
}
