#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> a(n + 1, vector<int>(n + 1));
  vector<vector<vector<int>>> dp(
      n + n, vector<vector<int>>(n + 2, vector<int>(n + 2, -1e9)));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  dp[1][1][1] = a[1][1];
  int sx = 1, sy = 2;
  for (int q = 2; q <= n + n - 1; q++) {
    int curx = sx, cury = sy;
    vector<pair<int, int>> c;
    while (curx <= n && cury > 0) {
      c.push_back({curx, cury});
      curx++;
      cury--;
    }
    int ix = 1;
    for (pair<int, int>& i : c) {
      int iy = 1;
      for (pair<int, int>& j : c) {
        int mx = -1e9;
        for (int p1 = -1; p1 <= 1; p1++) {
          for (int p2 = -1; p2 <= 1; p2++) {
            if (q <= n && max(p1, p2) > 0) continue;
            if (q > n && min(p1, p2) < 0) continue;
            mx = max(mx, dp[q - 1][ix + p1][iy + p2]);
          }
        }
        mx += a[i.first][i.second];
        if (ix != iy) mx += a[j.first][j.second];
        dp[q][ix][iy] = max(mx, dp[q][ix][iy]);
        iy++;
      }
      ix++;
    }
    sy++;
    if (sy > n) {
      sx++;
      sy = n;
    }
  }
  cout << dp[n + n - 1][1][1];
  return 0;
}
