#include <bits/stdc++.h>
using namespace std;
const int inf = -1e9;
const int maxn = 400;
int dp[maxn][maxn][maxn];
int a[maxn][maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i <= n + 1; i++)
    for (int j = 0; j <= n + 1; j++) a[i][j] = inf;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  for (int i = 0; i <= n + 1; i++)
    for (int j = 0; j <= n + 1; j++)
      for (int k = 0; k <= n + 1; k++) dp[i][j][k] = inf;
  dp[1][1][1] = a[1][1];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k <= n; k++) {
        int l = i + j - k;
        if (dp[i][j][k] > inf) continue;
        if (l <= 0 or l >= n + 1) {
          dp[i][j][k] = inf;
          continue;
        }
        int t1 = dp[i - 1][j][k - 1] + a[i][j] + a[k][l];
        int t2 = dp[i - 1][j][k] + a[i][j] + a[k][l];
        int t3 = dp[i][j - 1][k - 1] + a[i][j] + a[k][l];
        int t4 = dp[i][j - 1][k] + a[i][j] + a[k][l];
        dp[i][j][k] = max(max(t1, t2), max(t3, t4));
        if (i == k and j == l) dp[i][j][k] -= a[i][j];
        if (dp[i][j][k] < -1e7) dp[i][j][k] = 0;
      }
    }
  }
  cout << dp[n][n][n];
  return 0;
}
