#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
int g[300][300], dp[300][300][300], dx[] = {1, 0}, dy[] = {0, 1};
const int INF = 1 << 28;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> g[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        dp[i][j][k] = -INF;
      }
    }
  }
  dp[0][0][0] = g[0][0];
  for (int i = 0; i < 2 * n - 2; i++) {
    for (int j = max(0, i - n + 1); j <= min(i, n - 1); j++) {
      for (int k = max(0, i - n + 1); k <= j; k++) {
        for (int l = 0; l < 4; l++) {
          int x1 = j + dx[l / 2], y1 = i - j + dy[l / 2], x2 = k + dx[l % 2],
              y2 = i - k + dy[l % 2];
          if (x1 < n && y1 < n && x2 < n && y2 < n) {
            if (x1 == x2) {
              dp[x1][y1][x2] = max(dp[x1][y1][x2], dp[j][i - j][k] + g[x1][y1]);
            } else {
              dp[x1][y1][x2] =
                  max(dp[x1][y1][x2], dp[j][i - j][k] + g[x1][y1] + g[x2][y2]);
            }
          }
        }
      }
    }
  }
  cout << dp[n - 1][n - 1][n - 1] << endl;
  return 0;
}
