#include <bits/stdc++.h>
using namespace std;
const int mx[2] = {1, 0};
const int MAXN = 310;
const int INF = 1e9;
int N;
int A[MAXN][MAXN];
int dp[MAXN][MAXN][MAXN];
void setmax(int& a, int b) {
  if (a < b) {
    a = b;
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> A[i][j];
    }
  }
  for (int a = 0; a < N; a++) {
    for (int b = 0; b < N; b++) {
      for (int c = 0; c < N; c++) {
        dp[a][b][c] = -INF;
      }
    }
  }
  dp[0][0][0] = A[0][0];
  for (int a = 0; a < N; a++) {
    for (int b = 0; b < N; b++) {
      for (int c = 0; c < N; c++) {
        if (dp[a][b][c] == -INF) continue;
        for (int i = 0; i < 2; i++) {
          for (int j = 0; j < 2; j++) {
            int na = a + mx[i], nb = a + b + 1 - na;
            int nc = c + mx[j], nd = a + b + 1 - nc;
            auto in = [&](int x) -> bool { return 0 <= x && x < N; };
            if (in(na) && in(nb) && in(nc) && in(nd)) {
              int get = (na == nc ? A[na][nb] : A[na][nb] + A[nc][nd]);
              setmax(dp[na][nb][nc], dp[a][b][c] + get);
            }
          }
        }
      }
    }
  }
  cout << dp[N - 1][N - 1][N - 1] << endl;
  return 0;
}
