#include <bits/stdc++.h>
using namespace std;
int a[301][301], f[602][301][301];
int main() {
  memset(f, 128, sizeof(f));
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) scanf("%d", &a[i][j]);
  f[2][1][1] = a[1][1];
  for (int d = 3; d <= 2 * n; ++d) {
    for (int i = 1; i <= min(n, d); ++i) {
      for (int j = 1; j <= min(n, d); ++j) {
        int tmp = max(max(f[d - 1][i][j], f[d - 1][i - 1][j - 1]),
                      max(f[d - 1][i][j - 1], f[d - 1][i - 1][j]));
        f[d][i][j] = tmp + a[i][d - i] + (i != j ? a[j][d - j] : 0);
      }
    }
  }
  printf("%d\n", f[2 * n][n][n]);
  return 0;
}
