#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, w = 0;
  char ch = getchar();
  while (!isdigit(ch)) w |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  return w ? -x : x;
}
int n, a[304][304], f[304][304][304];
signed main() {
  n = read();
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) a[i][j] = read();
  memset(f, -0x3f, sizeof(f));
  f[0][1][0] = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      for (int k = 1; k <= i; ++k) {
        int p = i + j - k;
        f[i][j][k] = a[i][j] + (k != i) * a[k][p] +
                     max(max(f[i - 1][j][k - 1], f[i - 1][j][k]),
                         max(f[i][j - 1][k], f[i][j - 1][k - 1]));
      }
  printf("%d\n", f[n][n][n]);
  return 0;
}
