#include <bits/stdc++.h>
using namespace std;
const int maxn = 305;
const int INF = 1000000000;
int dp[maxn << 1][maxn][maxn], a[maxn][maxn], n;
int dfs(int s, int i, int j) {
  if (i > n || j > n || s - i > n || s - j > n) return -INF;
  if (i == n && j == n && s - i == n && s - j == n) return a[n][n];
  if (dp[s][i][j] != -INF) return dp[s][i][j];
  int res = a[i][s - i];
  if (i != j) res += a[j][s - j];
  for (int x = 0; x < 2; x++)
    for (int y = 0; y < 2; y++) {
      dp[s][i][j] = max(dp[s][i][j], dfs(s + 1, i + x, j + y) + res);
    }
  return dp[s][i][j];
}
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
    for (int i = 0; i <= n + n; i++)
      for (int j = 0; j <= n; j++)
        for (int k = 0; k <= n; k++) dp[i][j][k] = -INF;
    cout << dfs(2, 1, 1) << endl;
  }
  return 0;
}
