#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
int dp[2][310][310], a[310][310];
int main() {
  int N, i, j, s, r1, c1, r2, c2, rr1, cc1, rr2, cc2, cur, pre, tmp;
  scanf("%d", &N);
  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++) scanf("%d", &a[i][j]);
  memset(dp, 0xcf, sizeof(dp));
  dp[0][0][0] = a[0][0];
  cur = 1;
  pre = 0;
  for (s = 0; s < N * 2 - 2; s++) {
    memset(dp[cur], 0xcf, sizeof(dp[cur]));
    for (r1 = 0; r1 < N; r1++)
      for (r2 = r1; r2 < N; r2++) {
        c1 = s - r1;
        c2 = s - r2;
        if ((r1 < 0 || c1 < 0 || r1 >= N || c1 >= N) ||
            (r2 < 0 || c2 < 0 || r2 >= N || c2 >= N))
          continue;
        rr1 = r1 + 1;
        cc1 = c1;
        rr2 = r2 + 1;
        cc2 = c2;
        if (!(rr1 < 0 || cc1 < 0 || rr1 >= N || cc1 >= N) &&
            !(rr2 < 0 || cc2 < 0 || rr2 >= N || cc2 >= N)) {
          tmp = a[rr1][cc1];
          if (rr1 != rr2) tmp += a[rr2][cc2];
          if (rr1 > rr2) swap(rr1, rr2);
          chkmax(dp[cur][rr1][rr2], dp[pre][r1][r2] + tmp);
        }
        rr1 = r1 + 1;
        cc1 = c1;
        rr2 = r2;
        cc2 = c2 + 1;
        if (!(rr1 < 0 || cc1 < 0 || rr1 >= N || cc1 >= N) &&
            !(rr2 < 0 || cc2 < 0 || rr2 >= N || cc2 >= N)) {
          tmp = a[rr1][cc1];
          if (rr1 != rr2) tmp += a[rr2][cc2];
          if (rr1 > rr2) swap(rr1, rr2);
          chkmax(dp[cur][rr1][rr2], dp[pre][r1][r2] + tmp);
        }
        rr1 = r1;
        cc1 = c1 + 1;
        rr2 = r2 + 1;
        cc2 = c2;
        if (!(rr1 < 0 || cc1 < 0 || rr1 >= N || cc1 >= N) &&
            !(rr2 < 0 || cc2 < 0 || rr2 >= N || cc2 >= N)) {
          tmp = a[rr1][cc1];
          if (rr1 != rr2) tmp += a[rr2][cc2];
          if (rr1 > rr2) swap(rr1, rr2);
          chkmax(dp[cur][rr1][rr2], dp[pre][r1][r2] + tmp);
        }
        rr1 = r1;
        cc1 = c1 + 1;
        rr2 = r2;
        cc2 = c2 + 1;
        if (!(rr1 < 0 || cc1 < 0 || rr1 >= N || cc1 >= N) &&
            !(rr2 < 0 || cc2 < 0 || rr2 >= N || cc2 >= N)) {
          tmp = a[rr1][cc1];
          if (rr1 != rr2) tmp += a[rr2][cc2];
          if (rr1 > rr2) swap(rr1, rr2);
          chkmax(dp[cur][rr1][rr2], dp[pre][r1][r2] + tmp);
        }
      }
    swap(pre, cur);
  }
  printf("%d\n", dp[pre][N - 1][N - 1]);
  return 0;
}
