#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const long double pi = acos(-1.0);
const long double inf = 1000 * 1000 * 1000;
#pragma comment(linker, "/STACK:36777216")
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
long long xabs(long long a) { return a > 0 ? a : -a; }
int dp[700][302][302];
int sm[4][2] = {{0, 0}, {0, -1}, {-1, 0}, {-1, -1}};
int main() {
  for (int i = 0; i < 700; ++i)
    for (int j = 0; j < 302; ++j)
      for (int k = 0; k < 302; ++k) dp[i][j][k] = -inf;
  int n;
  cin >> n;
  vector<vector<int> > g(n, vector<int>(n));
  int m = n;
  for (int i = 0; i < n; i++)
    for (int k = 0; k < n; k++) cin >> g[i][k];
  dp[0][0][0] = g[0][0];
  for (int t = 1; t <= n + m - 2; t++) {
    for (int x1 = 0; x1 < n; x1++) {
      for (int x2 = 0; x2 < n; x2++) {
        for (int i = 0; i < 4; i++) {
          int nx1 = x1 + sm[i][0];
          int nx2 = x2 + sm[i][1];
          if (nx1 < n && nx2 < n && nx1 >= 0 && nx2 >= 0 && t - x1 >= 0 &&
              t - x2 >= 0 && t - x1 < n && t - x2 < n) {
            int tmp = dp[t - 1][nx1][nx2] + g[x1][t - x1] + g[x2][t - x2];
            if (x1 == x2) tmp -= g[x1][t - x1];
            dp[t][x1][x2] = max(dp[t][x1][x2], tmp);
          }
        }
      }
    }
  }
  int result = dp[n + m - 2][n - 1][n - 1];
  cout << result << endl;
  return 0;
}
