#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int n, a[303][303], dp[303][303][303], xx[] = {1, 0}, yy[] = {0, 1}, ans;
int f(int x, int y, int z) {
  if (x == n - 1 && y == n - 1) return 0 + a[x][y];
  if (dp[x][y][z] != -1e9) return dp[x][y][z];
  int ans = -1e9, k = (x + y) - z;
  for (int i = 0; i < 2; i++) {
    int tx = x + xx[i], ty = y + yy[i];
    for (int j = 0; j < 2; j++) {
      int tz = z + xx[j], tk = k + yy[j];
      if (tx < n && ty < n && tz < n && tk < n) {
        if (x == z && y == k)
          ans = max(ans, f(tx, ty, tz) + a[x][y]);
        else
          ans = max(ans, f(tx, ty, tz) + a[x][y] + a[z][k]);
      }
    }
  }
  return dp[x][y][z] = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int z = 0; z < n; z++) dp[i][j][z] = -1e9;
      cin >> a[i][j];
    }
  }
  cout << f(0, 0, 0);
}
