#include <bits/stdc++.h>
using namespace std;
int n;
int a[305 * 2][305];
int dp[2][305][305];
int dir[4][2] = {0, 0, -1, 0, 0, -1, -1, -1};
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i + j - 1][j];
    }
  }
  int pre = 0;
  for (int i = 0; i <= 2 * n; i++)
    for (int j = 0; j <= 2 * n; j++) dp[pre][i][j] = -(1 << 29);
  dp[pre][1][1] = a[1][1];
  for (int i = 2; i < 2 * n; i++) {
    int m = min(2 * n - i, i) + max(i - n + 1, 1);
    for (int j = 0; j <= n; j++)
      for (int k = 0; k <= n; k++) dp[pre ^ 1][j][k] = -(1 << 29);
    for (int j = max(i - n + 1, 1); j < m; j++)
      for (int k = j; k < m; k++) {
        for (int d = 0; d < 4; d++) {
          dp[pre ^ 1][j][k] =
              max(dp[pre ^ 1][j][k], dp[pre][j + dir[d][0]][k + dir[d][1]]);
        }
        if (j == k)
          dp[pre ^ 1][j][k] += a[i][j];
        else
          dp[pre ^ 1][j][k] += a[i][j] + a[i][k];
      }
    pre ^= 1;
  }
  cout << dp[pre][n][n] << endl;
  return 0;
}
