#include <bits/stdc++.h>
using namespace std;
const int N = 333;
int dp[2][N][N];
int max(int a, int b, int c) { return max(max(a, b), c); }
int max(int a, int b, int c, int d) { return max(max(a, b), max(c, d)); }
int a[N][N];
int DP(int h, int i, int j) {
  if (i <= 0 || h - i <= 0 || j <= 0 || h - j <= 0)
    return -999999999;
  else
    return dp[h & 1][i][j];
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) cin >> a[i][j];
  dp[2 & 1][1][1] = a[1][1];
  for (int h = 3; h <= n + n; ++h)
    for (int i = 1; i <= n; ++i)
      for (int j = i; j <= n; ++j) {
        if (i == j) {
          dp[h & 1][i][j] = max(DP(h - 1, i, i), DP(h - 1, i - 1, i),
                                DP(h - 1, i - 1, i - 1)) +
                            a[i][h - i];
        } else {
          dp[h & 1][i][j] = max(DP(h - 1, i, j), DP(h - 1, i - 1, j - 1),
                                DP(h - 1, i, j - 1), DP(h - 1, i - 1, j)) +
                            a[i][h - i] + a[j][h - j];
        }
      }
  cout << dp[(n + n) & 1][n][n] << endl;
  return 0;
}
