#include <bits/stdc++.h>
using namespace std;
int n, a[305][305], dp[2 * 305][305][305];
int f(int r1, int c1, int r2, int c2) {
  if (r1 > n || r2 > n || c1 > n || c2 > n) return -100000000;
  if (r1 == n && c1 == n) return a[n][n];
  int t = r1 + c1 - 1;
  if (dp[t][c1][c2] != -1) return dp[t][c1][c2];
  int ans = f(r1 + 1, c1, r2 + 1, c2);
  ans = max(ans, f(r1 + 1, c1, r2, c2 + 1));
  ans = max(ans, f(r1, c1 + 1, r2 + 1, c2));
  ans = max(ans, f(r1, c1 + 1, r2, c2 + 1));
  ans += a[r1][c1];
  if (r1 != r2 || c1 != c2) ans += a[r2][c2];
  return dp[t][c1][c2] = ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      scanf("%d", &a[i][j]);
      for (int t = 1; t < 2 * n; t++) dp[t][i][j] = -1;
    }
  printf("%d\n", f(1, 1, 1, 1));
  return 0;
}
