#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
int n;
int A[303][303];
int DP[303][303][303];
int d1[4] = {1, 1, 0, 0};
int d2[4] = {1, 0, 1, 0};
int solve(int x1, int x2, int diag) {
  if (x1 > n || x2 > n) return -INF;
  if (x1 < 1 || x2 < 1) return -INF;
  if ((diag - x1) > n || (diag - x2) > n) return -INF;
  if ((diag - x1) < 1 || (diag - x2) < 1) return -INF;
  if (x1 == n && x2 == n && (diag - x1) == n && (diag - x2) == n)
    return A[n][n];
  int &ret = DP[x1][x2][diag];
  if (ret != -1) return ret;
  ret = -INF;
  int cost = 0;
  if (x1 == x2)
    cost = A[x1][diag - x1];
  else
    cost = A[x1][diag - x1] + A[x2][diag - x2];
  for (int i = 0; i < 4; i++) {
    ret = max(ret, solve(x1 + d1[i], x2 + d2[i], diag + 1) + cost);
  }
  return ret;
}
int main() {
  cin >> n;
  memset(DP, -1, sizeof DP);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> A[i][j];
    }
  }
  cout << solve(1, 1, 2) << endl;
  return 0;
}
