#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX / 2;
const int Maxn = 305;
int a[Maxn + 5][Maxn + 5], f[Maxn + 5][Maxn + 5], g[Maxn + 5][Maxn + 5], n;
int solve() {
  for (int(i) = (1); (i) <= (n); ++(i))
    for (int(j) = (1); (j) <= (n); ++(j)) f[i][j] = -inf;
  f[1][1] = a[1][1];
  for (int(k) = (2); (k) <= (n * 2 - 1); ++(k)) {
    for (int(i) = (1); (i) <= (n); ++(i))
      for (int(j) = (1); (j) <= (n); ++(j)) g[i][j] = -inf;
    for (int(i) = (1); (i) <= (n); ++(i))
      for (int(j) = (i); (j) <= (n); ++(j)) {
        if (f[i][j] <= -inf) continue;
        for (int(si) = (i); (si) <= (i + 1); ++(si))
          for (int(sj) = (j); (sj) <= (j + 1); ++(sj)) {
            if (si > sj || si > n || sj > n || k + 1 - si > n || k + 1 - sj > n)
              continue;
            int bonus;
            if (si == sj)
              bonus = a[k + 1 - si][si];
            else
              bonus = a[k + 1 - si][si] + a[k + 1 - sj][sj];
            g[si][sj] = max(g[si][sj], f[i][j] + bonus);
          }
      }
    for (int(i) = (1); (i) <= (n); ++(i))
      for (int(j) = (1); (j) <= (n); ++(j)) f[i][j] = g[i][j];
  }
  return f[n][n];
}
int main() {
  iostream::sync_with_stdio(false);
  cin >> n;
  for (int(i) = (1); (i) <= (n); ++(i))
    for (int(j) = (1); (j) <= (n); ++(j)) cin >> a[i][j];
  cout << solve();
  return 0;
}
