#include <bits/stdc++.h>
const int N = 310;
const int inf = 0x3f3f3f3f;
using namespace std;
int a[N][N], dp[3][N][N], n;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) scanf("%d", &a[i][j]);
  for (int k = 0; k <= 2; k++)
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) dp[k][i][j] = -inf;
  dp[0][0][0] = a[0][0];
  for (int k = 0; k < 2 * n - 2; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j <= i; j++) {
        if (dp[k % 2][i][j] == -inf) continue;
        if (k - j < n - 1) {
          int t = a[i][k + 1 - i];
          if (i != j) t += a[j][k + 1 - j];
          dp[(k + 1) % 2][i][j] =
              max(dp[(k + 1) % 2][i][j], dp[k % 2][i][j] + t);
        }
        if (i < n - 1) {
          int t = a[i + 1][k - i];
          if (i != j) t += a[j + 1][k - j];
          dp[(k + 1) % 2][i + 1][j + 1] =
              max(dp[(k + 1) % 2][i + 1][j + 1], dp[k % 2][i][j] + t);
        }
        if (k - j < n - 1 && i < n - 1) {
          int t = a[i + 1][k - i];
          t += a[j][k + 1 - j];
          dp[(k + 1) % 2][i + 1][j] =
              max(dp[(k + 1) % 2][i + 1][j], dp[k % 2][i][j] + t);
        }
        if (k - i < n - 1 && j < n - 1 && j + 1 <= i) {
          int t = a[i][k + 1 - i];
          if (j + 1 != i) t += a[j + 1][k - j];
          dp[(k + 1) % 2][i][j + 1] =
              max(dp[(k + 1) % 2][i][j + 1], dp[k % 2][i][j] + t);
        }
      }
    }
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) dp[k % 2][i][j] = -inf;
  }
  printf("%d\n", dp[(n + n - 2) % 2][n - 1][n - 1]);
  return 0;
}
