#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300 + 2;
const int MAXA = 1e3 + 3;
const int INF = 0x3f3f3f3f;
int n;
int a[MAXN][MAXN];
int dp[MAXN * 2][MAXN][MAXN];
bool outOfRange(int x, int y) { return x < 0 || x >= n || y < 0 || y >= n; }
void upmax(int &x, int v) {
  if (x < v) x = v;
}
void solve() {
  for (int i = 0; i < (int)(2 * n); ++i)
    for (int j = 0; j < (int)(n); ++j)
      for (int k = 0; k < (int)(n); ++k) dp[i][j][k] = -INF;
  dp[0][0][0] = a[0][0];
  for (int i = 0; i < (int)(2 * (n - 1)); ++i)
    for (int j = 0; j < (int)(n); ++j)
      for (int k = 0; k < (int)(n); ++k) {
        int dx[2] = {0, 1};
        int dy[2] = {1, 0};
        for (int d1 = 0; d1 < 2; ++d1) {
          int nx1 = j + dx[d1];
          int ny1 = (i - j) + dy[d1];
          if (outOfRange(nx1, ny1)) continue;
          for (int d2 = 0; d2 < 2; ++d2) {
            int nx2 = k + dx[d2];
            int ny2 = (i - k) + dy[d2];
            if (outOfRange(nx2, ny2)) continue;
            if (nx1 == nx2 && ny1 == ny2)
              upmax(dp[i + 1][nx1][nx2], dp[i][j][k] + a[nx1][ny1]);
            else
              upmax(dp[i + 1][nx1][nx2],
                    dp[i][j][k] + a[nx1][ny1] + a[nx2][ny2]);
          }
        }
      }
  printf("%d\n", dp[2 * (n - 1)][n - 1][n - 1]);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) scanf("%d", &a[i][j]);
  solve();
  return 0;
}
