#include <bits/stdc++.h>
using namespace std;
const int N = 305;
int n, f[N * 2][N][N], a[N][N];
inline int read() {
  int ret = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    ret = ret * 10 + (ch ^ 48);
    ch = getchar();
  }
  return ret * ff;
}
void write(int x) {
  if (x < 0) {
    x = -x, putchar('-');
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + 48);
}
void writeln(int x) { write(x), puts(""); }
void writesp(int x) { write(x), putchar(' '); }
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][1] = a[1][1];
  for (int i = 1; i <= 2 * n - 2; i++) {
    for (int j = 1; j <= n && i - j + 2 >= 1; j++) {
      for (int k = 1; k <= n && i - k + 2 >= 1; k++) {
        if (i - j + 2 <= n && i - k + 2 <= n) {
          int val =
              (j == k ? a[j][i - j + 2] : a[j][i - j + 2] + a[k][i - k + 2]);
          f[i][j][k] = max(f[i][j][k], f[i - 1][j][k] + val);
          if (j > 1) f[i][j][k] = max(f[i][j][k], f[i - 1][j - 1][k] + val);
          if (k > 1) f[i][j][k] = max(f[i][j][k], f[i - 1][j][k - 1] + val);
          if (j > 1 && k > 1)
            f[i][j][k] = max(f[i][j][k], f[i - 1][j - 1][k - 1] + val);
        }
      }
    }
  }
  write(f[2 * n - 2][n][n]);
  return 0;
}
