#include <bits/stdc++.h>
using namespace std;
int n, mat[304][304];
int dp[605][305][305];
int calc(int D, int first, int second) {
  int firstcal = first, firstrow = D - first, secondcal = second,
      secondrow = D - second;
  if (firstcal == secondcal && firstcal == secondrow && firstcal == firstrow &&
      firstcal == n - 1) {
    return mat[firstrow][secondrow];
  }
  if (firstcal >= n || secondcal >= n || firstrow >= n || secondrow >= n)
    return -1e9;
  if (dp[D][first][second] != -1) return dp[D][first][second];
  long long ans =
      max({calc(D + 1, first, second), calc(D + 1, first, second + 1),
           calc(D + 1, first + 1, second),
           calc(D + 1, first + 1, second + 1)}) +
      mat[firstrow][firstcal] + mat[secondrow][secondcal];
  if (firstcal == secondcal && firstrow == secondrow)
    ans -= mat[firstrow][firstcal];
  return dp[D][first][second] = ans;
}
int main() {
  cin >> n;
  memset(dp, -1, sizeof dp);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> mat[i][j];
    }
  }
  cout << calc(0, 0, 0) << endl;
  return 0;
}
