#include <bits/stdc++.h>
using namespace std;
int n, A[301][301], dp[301][301];
int solve() {
  for (int i = 0; i < 2 * n - 1; i++) {
    for (int j = n - 1; j >= 0; j--)
      for (int k = n - 1; k >= 0; k--) {
        int ad;
        if (j == k)
          ad = A[j][i - j];
        else
          ad = A[j][i - j] + A[k][i - k];
        int a = j, b = i - j, c = k, d = i - k, maxi = -1 * 1000000000;
        if (i - 1 >= 0) {
          if (a - 1 >= 0 && c - 1 >= 0) {
            maxi = max(maxi, dp[j - 1][k - 1]);
          }
          if (a - 1 >= 0 && d - 1 >= 0) {
            maxi = max(maxi, dp[j - 1][k]);
          }
          if (b - 1 >= 0 && c - 1 >= 0) {
            maxi = max(maxi, dp[j][k - 1]);
          }
          if (b - 1 >= 0 && d - 1 >= 0) {
            maxi = max(maxi, dp[j][k]);
          }
          dp[j][k] = maxi + ad;
        } else {
          dp[j][k] = A[0][0];
        }
      }
  }
  return dp[n - 1][n - 1];
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> A[i][j];
  cout << solve() << '\n';
}
