#include <bits/stdc++.h>
const int inf = -1061109567;
const double eps = 1e-9;
using namespace std;
int a[333][333], f[333][333], g[333][333], n;
inline void rel(int i1, int j1, int i2, int j2, int F) {
  if (i1 > n || i2 > n || j2 > n || j1 > n) return;
  int r = a[i1][j1] + a[i2][j2] + F;
  if (i1 == i2 && j1 == j2) r -= a[i1][j1];
  g[i1][i2] = max(g[i1][i2], r);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
  if (n == 1) {
    cout << (a[1][1]) << endl;
    return 0;
  }
  memset(f, -63, sizeof(f));
  f[1][1] = a[1][1];
  for (int k = 1; k <= n + n - 2; k++) {
    memset(g, -63, sizeof(g));
    for (int i1 = 1; i1 <= n; i1++)
      for (int i2 = 1; i2 <= n; i2++)
        if (f[i1][i2] != inf) {
          int j1 = k - i1 + 1, j2 = k - i2 + 1;
          for (int p1 = 0; p1 <= 1; p1++)
            for (int p2 = 0; p2 <= 1; p2++)
              rel(i1 + p1, j1 + (1 - p1), i2 + p2, j2 + (1 - p2), f[i1][i2]);
        }
    for (int i1 = 1; i1 <= n; i1++)
      for (int i2 = 1; i2 <= n; i2++) f[i1][i2] = g[i1][i2];
  }
  cout << (f[n][n]) << endl;
  return 0;
}
