#include <bits/stdc++.h>
using namespace std;
int arr[303][303];
int dp[606][303][303];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", arr[i] + j);
    }
  }
  for (int i = 0; i < 2 * (n - 1) + 1; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++) dp[i][j][k] = -(1 << 22);
  dp[0][0][0] = arr[0][0];
  for (int dia = 0; dia < 2 * (n - 1); dia++) {
    ;
    for (int x1 = 0; x1 < n; x1++) {
      for (int x2 = 0; x2 < n; x2++) {
        int y1, y2;
        y1 = dia - x1;
        y2 = dia - x2;
        if (x1 + 1 < n && x2 + 1 < n) {
          int dod = arr[x1 + 1][y1] + arr[x2 + 1][y2];
          if (x1 + 1 == x2 + 1 && y1 == y2) dod -= arr[x2 + 1][y2];
          dp[dia + 1][x1 + 1][x2 + 1] =
              max(dp[dia + 1][x1 + 1][x2 + 1], dp[dia][x1][x2] + dod);
        }
        if (x1 + 1 < n && y2 + 1 < n) {
          int dod = arr[x1 + 1][y1] + arr[x2][y2 + 1];
          if (x1 + 1 == x2 && y1 == y2 + 1) dod -= arr[x2][y2 + 1];
          dp[dia + 1][x1 + 1][x2] =
              max(dp[dia + 1][x1 + 1][x2], dp[dia][x1][x2] + dod);
        }
        if (y1 + 1 < n && x2 + 1 < n) {
          int dod = arr[x1][y1 + 1] + arr[x2 + 1][y2];
          if (x1 == x2 + 1 && y1 + 1 == y2) dod -= arr[x2 + 1][y2];
          dp[dia + 1][x1][x2 + 1] =
              max(dp[dia + 1][x1][x2 + 1], dp[dia][x1][x2] + dod);
        }
        if (y1 + 1 < n && y2 + 1 < n) {
          int dod = arr[x1][y1 + 1] + arr[x2][y2 + 1];
          if (x1 == x2 && y1 + 1 == y2 + 1) dod -= arr[x2][y2 + 1];
          dp[dia + 1][x1][x2] = max(dp[dia + 1][x1][x2], dp[dia][x1][x2] + dod);
        }
      }
    }
  }
  printf("%d\n", dp[2 * (n - 1)][n - 1][n - 1]);
  return 0;
}
