#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > arr(305, vector<int>(305));
int n;
int memo[2 * 305][305][305];
inline int dp(int k, int x1, int x2) {
  if (x1 == n && x2 == n && k == (2 * n - 1)) return arr[n][n];
  if (x1 > n || x2 > n || k > 2 * n - 1 || x1 > x2 || k - x1 + 1 < 1 ||
      k - x1 + 1 > n || k - x2 + 1 < 1 || k - x2 + 1 > n)
    return -30000009;
  if (memo[k][x1][x2] != -30000009) return memo[k][x1][x2];
  int ans = dp(k + 1, x1, x2);
  ans = max(ans, dp(k + 1, x1, x2 + 1));
  ans = max(ans, dp(k + 1, x1 + 1, x2 + 1));
  ans = max(ans, dp(k + 1, x1 + 1, x2));
  ans += arr[x1][k - x1 + 1] + arr[x2][k - x2 + 1];
  if (x1 == x2) ans -= arr[x1][k - x1 + 1];
  return memo[k][x1][x2] = ans;
}
int main() {
  cin >> n;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < n + 1; j++) cin >> arr[i][j];
  for (int i = 0; i < 2 * n + 1; i++)
    for (int j = 0; j < n + 1; j++)
      for (int k = 0; k < n + 1; k++) memo[i][j][k] = -30000009;
  cout << dp(1, 1, 1) << endl;
}
