#include <bits/stdc++.h>
using namespace std;
const int INF = 1E9;
int grid[309][309];
int DP[309][309][609];
int d1[5] = {1, 0, 1, 0};
int d2[5] = {0, 1, 1, 0};
int rc;
int maxNum(int pos, int pos1, int pos2) {
  if (pos1 == rc && pos2 == rc && (pos - pos1) == rc) {
    return grid[rc][rc];
  }
  if (pos1 > rc || pos2 > rc) {
    return -INF;
  }
  if ((pos - pos1) > rc || (pos - pos2) > rc) {
    return -INF;
  }
  int &save = DP[pos1][pos2][pos];
  if (save != -1) {
    return save;
  }
  save = -INF;
  int point;
  if (pos1 == pos2) {
    point = grid[pos1][(pos - pos1)];
  } else {
    point = grid[pos1][(pos - pos1)] + grid[pos2][(pos - pos2)];
  }
  for (int i = 0; i < 4; i++) {
    save = max(save, maxNum(pos + 1, pos1 + d1[i], pos2 + d2[i]) + point);
  }
  return save;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> rc;
  memset(DP, -1, sizeof(DP));
  for (int i = 1; i <= rc; i++) {
    for (int j = 1; j <= rc; j++) {
      cin >> grid[i][j];
    }
  }
  cout << maxNum(2, 1, 1) << endl;
  return 0;
}
