#include <bits/stdc++.h>
using namespace std;
int n, a[301][301], dp[301][301][301];
int solve(int i, int j, int k) {
  if (i == n && j == n && k == 0) return a[n][n];
  int x = i + k, y = j - k;
  if (x < 1 || y < 1 || x > n || y > n || i < 1 || j < 1 || i > n || j > n ||
      k < 0)
    return -1e9;
  if (dp[i][j][k] != -2.1e9) return dp[i][j][k];
  return dp[i][j][k] = a[i][j] + (k != 0) * a[x][y] +
                       max(max(solve(i + 1, j, k), solve(i + 1, j, k - 1)),
                           max(solve(i, j + 1, k + 1), solve(i, j + 1, k)));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) cin >> a[i][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      for (int k = 0; k <= n; ++k) dp[i][j][k] = -2.1e9;
  cout << solve(1, 1, 0);
}
