#include <bits/stdc++.h>
using namespace std;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
bool isone(long long, int);
int count(long long);
long long exp(long long, long long, long long);
long long GCD(long long, long long);
int a[303][303];
int dp[2][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", &a[i][j]);
  dp[0][0][0] = a[0][0];
  int cnt = 0;
  while (cnt <= (2 * (n - 1))) {
    int idx = cnt & 1;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) dp[1 - idx][i][j] = -1000000007;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        int k = cnt - i, l = cnt - j;
        if ((k < 0) || (l < 0)) continue;
        if (((i + 1) < n) && ((j + 1) < n)) {
          if (((i + 1) != (j + 1)) || ((k) != (l)))
            dp[1 - idx][i + 1][j + 1] =
                max(dp[1 - idx][i + 1][j + 1],
                    dp[idx][i][j] + a[i + 1][k] + a[j + 1][l]);
          else
            dp[1 - idx][i + 1][j + 1] =
                max(dp[1 - idx][i + 1][j + 1], dp[idx][i][j] + a[j + 1][l]);
        }
        if (((i + 1) < n) && ((l + 1) < n)) {
          if (((i + 1) != (j)) || ((k) != (l + 1)))
            dp[1 - idx][i + 1][j] =
                max(dp[1 - idx][i + 1][j],
                    dp[idx][i][j] + a[i + 1][k] + a[j][l + 1]);
          else
            dp[1 - idx][i + 1][j] =
                max(dp[1 - idx][i + 1][j], dp[idx][i][j] + a[j][l + 1]);
        }
        if (((j + 1) < n) && ((k + 1) < n)) {
          if (((i) != (j + 1)) || ((k + 1) != (l)))
            dp[1 - idx][i][j + 1] =
                max(dp[1 - idx][i][j + 1],
                    dp[idx][i][j] + a[i][k + 1] + a[j + 1][l]);
          else
            dp[1 - idx][i][j + 1] =
                max(dp[1 - idx][i][j + 1], dp[idx][i][j] + a[j + 1][l]);
        }
        if (((k + 1) < n) && ((l + 1) < n)) {
          if (((i) != (j)) || ((k + 1) != (l + 1)))
            dp[1 - idx][i][j] = max(dp[1 - idx][i][j],
                                    dp[idx][i][j] + a[i][k + 1] + a[j][l + 1]);
          else
            dp[1 - idx][i][j] =
                max(dp[1 - idx][i][j], dp[idx][i][j] + a[j][l + 1]);
        }
      }
    }
    cnt++;
  }
  printf("%d\n", dp[(2 * (n - 1)) & 1][n - 1][n - 1]);
  return 0;
}
long long GCD(long long a, long long b) {
  if (!b)
    return a;
  else
    return GCD(b, a % b);
}
long long exp(long long a, long long b, long long c) {
  long long ret = 1LL;
  long long mult = a;
  while (b) {
    if (b & 1) ret = (ret * mult) % c;
    mult = (mult * mult) % c;
    b >>= 1;
  }
  return ret;
}
int count(long long x) {
  int ret = 0;
  while (x) {
    if (x & 1) ret++;
    x >>= 1LL;
  }
  return ret;
}
bool isone(long long x, int pos) { return x & (1 << pos); }
