#include <bits/stdc++.h>
using namespace std;
const int MAXN = 305;
int N;
int dp[2 * MAXN][MAXN][MAXN], nums[MAXN][MAXN];
int solve(int mov, int r1, int r2) {
  int l1 = mov - r1;
  int l2 = mov - r2;
  if (l1 > N || l2 > N || r1 > N || r2 > N) return -0x3f3f3f3f;
  if (r1 == l1 && l1 == N) return nums[N][N];
  if (dp[mov][r1][r2] == -0x3f3f3f3f) {
    int &cur = dp[mov][r1][r2];
    cur = solve(mov + 1, r1, r2);
    cur = max(cur, solve(mov + 1, r1 + 1, r2));
    cur = max(cur, solve(mov + 1, r1, r2 + 1));
    cur = max(cur, solve(mov + 1, r1 + 1, r2 + 1));
    cur += nums[l1][r1] + ((r1 == r2) ? 0 : nums[l2][r2]);
  }
  return dp[mov][r1][r2];
}
void test_case() {
  cin >> N;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= N; j++) cin >> nums[i][j];
  for (int i = 2; i <= 2 * N; i++) {
    for (int j = 1; j <= N; j++) {
      for (int k = 1; k <= N; k++) {
        dp[i][j][k] = -0x3f3f3f3f;
      }
    }
  }
  long long int ans = solve(2, 1, 1);
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    test_case();
  }
  return 0;
}
