#include <bits/stdc++.h>
using namespace std;
long long inf = 1LL * 1e16 + 7;
int n;
int a[305][305];
long long dp[305][305];
int cl(int x) { return min(x, n); }
int cl2(int x) { return max(1, x - n + 1); }
int main() {
  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[1][1] = a[1][1];
  for (int i = 2; i < n * 2; ++i) {
    int m = cl(i);
    int gr = cl2(i);
    for (int j = m; j >= gr; --j) {
      for (int l = m; l >= gr; --l) {
        int y = i - j + 1;
        int def = a[j][y];
        if (l != j) {
          y = i - l + 1;
          def += a[l][y];
        }
        dp[j][l] = max(dp[j - 1][l - 1],
                       max(dp[j][l - 1], max(dp[j - 1][l], dp[j][l]))) +
                   def;
      }
    }
  }
  printf("%lld", dp[n][n]);
  return 0;
}
