#include <bits/stdc++.h>
using namespace std;
const int n = 1e3;
long long a[n][n], cur[n][n], sdfsdf[n][n];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      scanf("%lld", &a[i][j]);
      cur[i][j] = -1e9;
    }
  cur[0][0] = a[0][0];
  for (int sum = 0; sum < n + n - 2; sum++) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) {
        sdfsdf[i][j] = -1e9;
      }
    for (int x1 = 0; x1 < n && x1 <= sum; x1++)
      for (int x2 = 0; x2 < n && x2 <= sum; x2++) {
        int y1 = sum - x1, y2 = sum - x2;
        if (min(y1, y2) < 0) {
          continue;
        }
        if (max(x1, x2) + 1 < n) {
          long long val = cur[x1][x2];
          val += a[x1 + 1][y1];
          val += make_pair(x1, y1) == make_pair(x2, y2) ? 0 : a[x2 + 1][y2];
          sdfsdf[x1 + 1][x2 + 1] = max(sdfsdf[x1 + 1][x2 + 1], val);
        }
        if (max(y1, y2) < n) {
          long long val = cur[x1][x2];
          val += a[x1][y1 + 1];
          val += make_pair(x1, y1) == make_pair(x2, y2) ? 0 : a[x2][y2 + 1];
          sdfsdf[x1][x2] = max(sdfsdf[x1][x2], val);
        }
        if (x1 + 1 < n && y2 + 1 < n) {
          long long val = cur[x1][x2];
          val += a[x1 + 1][y1];
          val += make_pair(x1 + 1, y1) == make_pair(x2, y2 + 1) ? 0
                                                                : a[x2][y2 + 1];
          sdfsdf[x1 + 1][x2] = max(sdfsdf[x1 + 1][x2], val);
        }
        if (y1 + 1 < n && x2 + 1 < n) {
          long long val = cur[x1][x2];
          val += a[x1][y1 + 1];
          val += make_pair(x1, y1 + 1) == make_pair(x2 + 1, y2) ? 0
                                                                : a[x2 + 1][y2];
          sdfsdf[x1][x2 + 1] = max(sdfsdf[x1][x2 + 1], val);
        }
      }
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) {
        cur[i][j] = sdfsdf[i][j];
      }
  }
  printf("%lld", cur[n - 1][n - 1]);
}
