#include <bits/stdc++.h>
int dp[610][610];
int dp1[610][610];
int a[310][310];
int ind[310][310];
int x[610][610], y[610][610];
void init(int n) {
  int i = 1, j = 1, k;
  for (int t = 1; t < (n << 1); t++) {
    int ii = i, jj = j;
    k = 1;
    while (ii >= 1 && jj <= n)
      ind[ii][jj] = k, x[t][k] = ii, y[t][k] = jj, k++, ii--, jj++;
    if (i < n)
      i++;
    else
      j++;
  }
}
int main() {
  int n, i, j, t, k, num, i1, j1, i2, j2, ii1, jj1, ii2, jj2;
  int xx;
  scanf("%d", &n);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) scanf("%d", &a[i][j]);
  init(n);
  dp[1][1] = a[1][1];
  num = 1, xx = 1;
  for (int tim = 1; tim < (n << 1) - 1; tim++) {
    xx++;
    t = num;
    if (xx <= n)
      num++;
    else
      num--;
    for (i = 1; i <= num; i++)
      for (j = 1; j <= num; j++) dp1[i][j] = -2100000000;
    for (i = 1; i <= t; i++)
      for (j = i; j <= t; j++) {
        i1 = x[tim][i], j1 = y[tim][i];
        i2 = x[tim][j], j2 = y[tim][j];
        ii1 = i1 + 1, jj1 = j1;
        ii2 = i2 + 1, jj2 = j2;
        if (ii1 <= n && ii2 <= n && jj2 <= n && jj1 <= n) {
          if (ii1 == ii2 && jj1 == jj2)
            k = a[ii1][jj1];
          else
            k = a[ii1][jj1] + a[ii2][jj2];
          if (dp1[ind[ii1][jj1]][ind[ii2][jj2]] < dp[i][j] + k)
            dp1[ind[ii1][jj1]][ind[ii2][jj2]] = dp[i][j] + k;
        }
        ii1 = i1 + 1, jj1 = j1;
        ii2 = i2, jj2 = j2 + 1;
        if (ii1 <= n && ii2 <= n && jj2 <= n && jj1 <= n) {
          if (ii1 == ii2 && jj1 == jj2)
            k = a[ii1][jj1];
          else
            k = a[ii1][jj1] + a[ii2][jj2];
          if (dp1[ind[ii1][jj1]][ind[ii2][jj2]] < dp[i][j] + k)
            dp1[ind[ii1][jj1]][ind[ii2][jj2]] = dp[i][j] + k;
        }
        ii1 = i1, jj1 = j1 + 1;
        ii2 = i2 + 1, jj2 = j2;
        if (ii1 <= n && ii2 <= n && jj2 <= n && jj1 <= n) {
          if (ii1 == ii2 && jj1 == jj2)
            k = a[ii1][jj1];
          else
            k = a[ii1][jj1] + a[ii2][jj2];
          if (dp1[ind[ii1][jj1]][ind[ii2][jj2]] < dp[i][j] + k)
            dp1[ind[ii1][jj1]][ind[ii2][jj2]] = dp[i][j] + k;
        }
        ii1 = i1, jj1 = j1 + 1;
        ii2 = i2, jj2 = j2 + 1;
        if (ii1 <= n && ii2 <= n && jj2 <= n && jj1 <= n) {
          if (ii1 == ii2 && jj1 == jj2)
            k = a[ii1][jj1];
          else
            k = a[ii1][jj1] + a[ii2][jj2];
          if (dp1[ind[ii1][jj1]][ind[ii2][jj2]] < dp[i][j] + k)
            dp1[ind[ii1][jj1]][ind[ii2][jj2]] = dp[i][j] + k;
        }
      }
    memcpy(dp, dp1, sizeof(dp));
  }
  printf("%d\n", dp[1][1]);
}
