#include <bits/stdc++.h>
int f[330][330][330] = {0};
int main() {
  int n, b[330][330] = {0}, x = 1, y = 1, k = 1, t, j, i, m;
  scanf("%d", &n);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) scanf("%d", &b[i][j]);
  for (i = 1; i <= n; i++)
    for (k = 1; k <= n; k++)
      for (t = i; t < i + k; t++) {
        if (t > n || i + k - t > n) break;
        int r = 0;
        if (i != t)
          r = b[i][k] + b[t][i + k - t];
        else
          r = b[i][k];
        m = -999999999;
        if (i > 1 && t > 1 && m < f[i - 1][k][t - 1]) {
          m = f[i - 1][k][t - 1];
        }
        if (i > 1 && i + k - t > 1 && m < f[i - 1][k][t]) {
          m = f[i - 1][k][t];
        }
        if (k > 1 && t > 1 && t - 1 >= i && m < f[i][k - 1][t - 1]) {
          m = f[i][k - 1][t - 1];
        }
        if (k > 1 && i + k - t > 1 && m < f[i][k - 1][t]) {
          m = f[i][k - 1][t];
        }
        f[i][k][t] = m + r;
        if (i == 1 && k == 1 & t == 1) f[i][k][t] = r;
      }
  printf("%d\n", f[n][n][n]);
  return 0;
}
