#include <bits/stdc++.h>
using namespace std;
const int N = 2e6;
const long long mod = 1e9 + 7;
const long long inf = 1e9;
long long a[610][610], f[2][610][610];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 0; i <= 600; i++)
    for (int j = 0; j <= 600; j++) {
      a[i][j] = -inf;
      f[0][i][j] = -inf;
      f[1][i][j] = -inf;
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  f[0][1][1] = a[1][1];
  for (int k = 3; k <= n + n; k++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        int x = k % 2, y = 1 - x;
        if (i >= k || j >= k) {
          f[x][i][j] = -inf;
          continue;
        }
        if (k - i > n || k - j > n) {
          f[x][i][j] = -inf;
          continue;
        }
        long long w = -inf;
        for (int dx = -1; dx <= 0; dx++)
          for (int dy = -1; dy <= 0; dy++) w = max(w, f[y][i + dx][j + dy]);
        f[x][i][j] = w;
        if (i != j)
          f[x][i][j] += a[i][k - i] + a[j][k - j];
        else
          f[x][i][j] += a[i][k - i];
      }
    }
  }
  cout << f[0][n][n];
}
