#include <bits/stdc++.h>
using namespace std;
int M[302][302][302], A[302][302], n, i, j;
int f(int x, int y, int z) {
  int &r = M[x][y][z];
  int t = x + y - z;
  if (r != -1) return r;
  if (x > n || y > n || z > n || t > n) return -94194194;
  r = A[x][y] + A[z][t] - (x == z && y == t) * A[x][y];
  if (x == n && y == n) return A[n][n];
  return r += max(max(f(x, y + 1, z), f(x + 1, y, z)),
                  max(f(x, y + 1, z + 1), f(x + 1, y, z + 1)));
}
int main() {
  cin >> n;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) cin >> A[i][j];
  for (int i = 0; i < 302; i++)
    for (int j = 0; j < 302; j++)
      for (int k = 0; k < 302; k++) M[i][j][k] = -1;
  cout << f(1, 1, 1);
  return 0;
}
