#include <bits/stdc++.h>
using namespace std;
const int N = 305;
const int inf = 0x3f3f3f3f;
const double eps = 1e-5;
int n, c;
int dp[605][N][N], a[N][N];
int max(int a, int b, int c, int d) { return max(max(a, b), max(c, d)); }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
  memset(dp, -inf, sizeof(dp));
  dp[0][1][1] = a[1][1];
  int l = (n - 1) * 2;
  for (int i = 1; i <= l; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k <= n; k++) {
        if (k == j)
          c = a[j][i + 2 - j];
        else
          c = a[j][i + 2 - j] + a[k][i + 2 - k];
        dp[i][j][k] = max(dp[i - 1][j - 1][k - 1], dp[i - 1][j][k - 1],
                          dp[i - 1][j - 1][k], dp[i - 1][j][k]) +
                      c;
      }
    }
  }
  printf("%d\n", dp[l][n][n]);
  return 0;
}
