#include <bits/stdc++.h>
using namespace std;
int dp[606][303][303];
int solve(int n, vector<vector<int>> &vec, int d, int x1, int x2) {
  if (d > n + n - 2) {
    return 0;
  }
  if (x1 >= n || x2 >= n) {
    return -0x3f3f3f3f;
  }
  int y1 = d - x1, y2 = d - x2;
  if (y1 >= n || y2 >= n) {
    return -0x3f3f3f3f;
  }
  if (dp[d][x1][x2] != -1) {
    return dp[d][x1][x2];
  }
  int temp = 0;
  temp =
      max(max(solve(n, vec, d + 1, x1 + 1, x2 + 1),
              solve(n, vec, d + 1, x1 + 1, x2)),
          max(solve(n, vec, d + 1, x1, x2 + 1), solve(n, vec, d + 1, x1, x2)));
  if (x1 == x2 && y1 == y2) {
    temp += vec[x1][y1];
  } else {
    temp += vec[x1][y1] + vec[x2][y2];
  }
  dp[d][x1][x2] = temp;
  return temp;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> vec(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> vec[i][j];
    }
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(n, vec, 0, 0, 0);
  return 0;
}
