#include <bits/stdc++.h>
using namespace std;
const int N = 301;
int a[N][N];
int f[N * 2 + 2][N][N];
int i, j, n, x, y, t;
int max(int b, int c, int d, int e) { return max(max(b, c), max(d, e)); }
void Main() {
  memset(f, -10, sizeof(f));
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  f[1][1][1] = a[1][1];
  for (int i = 2; i <= n + n - 1; i++)
    for (int x = 1; x <= n; x++)
      for (int y = 1; y <= n; y++)
        if (i + 1 - x > 0 && i + 1 - y > 0) {
          f[i][x][y] = max(f[i - 1][x - 1][y], f[i - 1][x - 1][y - 1],
                           f[i - 1][x][y - 1], f[i - 1][x][y]);
          if (x != y)
            f[i][x][y] = f[i][x][y] + a[x][i + 1 - x] + a[y][i + 1 - y];
          if (x == y) f[i][x][y] = f[i][x][y] + a[x][i + 1 - x];
        }
  cout << f[n + n - 1][n][n] << endl;
}
int main() {
  while (cin >> n && n) {
    Main();
  }
  return 0;
}
