#include <bits/stdc++.h>
using namespace std;
const int maxn = 300 + 10;
int d[maxn * 2][maxn][maxn], sz[maxn * 2], n, a[maxn][maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  for (int i = 2; i <= n + 1; i++) sz[i] = i - 1;
  for (int i = 2; i <= n; i++) sz[n + i] = n - i + 1;
  for (int i = 2; i <= 2 * n; i++)
    for (int j = 0; j <= n + 1; j++)
      for (int l = 0; l <= n + 1; l++) d[i][j][l] = -1000 * 1000 * 1000;
  d[2][1][1] = a[1][1];
  for (int i = 3; i <= 2 * n; i++)
    for (int j = 1; j <= sz[i]; j++)
      for (int l = j; l <= sz[i]; l++) {
        if (sz[i] > sz[i - 1]) {
          int x0 = j, y0 = i - j, x1 = l, y1 = i - l;
          d[i][j][l] = a[x0][y0];
          if (j != l) d[i][j][l] += a[x1][y1];
          d[i][j][l] += max(max(d[i - 1][j][l], d[i - 1][j - 1][l - 1]),
                            max(d[i - 1][j - 1][l], d[i - 1][j][l - 1]));
        } else {
          int y0 = n - j + 1, y1 = n - l + 1, x0 = i - (n - j + 1),
              x1 = i - (n - l + 1);
          d[i][j][l] = a[x0][y0];
          if (j != l) d[i][j][l] += a[x1][y1];
          d[i][j][l] += max(max(d[i - 1][j][l], d[i - 1][j + 1][l + 1]),
                            max(d[i - 1][j + 1][l], d[i - 1][j][l + 1]));
        }
      }
  cout << d[2 * n][1][1] << endl;
  return 0;
}
