#include <bits/stdc++.h>
using namespace std;
const int maxn = 305;
const int maxint = 999999999;
int dp[2][maxn][maxn];
int a[maxn][maxn];
int n;
bool judge(int x, int y) { return (x >= 1 && x <= n && y >= 1 && y <= n); }
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
    dp[1][1][1] = a[1][1];
    for (int i = 2; i <= 2 * n - 1; i++) {
      for (int j = 1; j <= n; j++)
        for (int k = 1; k <= n; k++) dp[i % 2][j][k] = -maxint;
      for (int j = 1; j <= n; j++) {
        for (int k = 1; k <= n; k++) {
          int x1 = i - j + 1, y1 = j, x2 = i - k + 1, y2 = k;
          if (judge(x1, y1) == false || judge(x2, y2) == false) continue;
          int value;
          if (j == k)
            value = a[x1][y1];
          else
            value = a[x1][y1] + a[x2][y2];
          if (j - 1 >= 1 && k - 1 >= 1) {
            dp[i % 2][j][k] =
                max(dp[i % 2][j][k], dp[(i - 1) % 2][j - 1][k - 1] + value);
          }
          if (j - 1 >= 1 && x2 - 1 >= 1) {
            dp[i % 2][j][k] =
                max(dp[i % 2][j][k], dp[(i - 1) % 2][j - 1][k] + value);
          }
          if (x1 - 1 >= 1 && k - 1 >= 1) {
            dp[i % 2][j][k] =
                max(dp[i % 2][j][k], dp[(i - 1) % 2][j][k - 1] + value);
          }
          if (x1 - 1 >= 1 && x2 - 1 >= 1) {
            dp[i % 2][j][k] =
                max(dp[i % 2][j][k], dp[(i - 1) % 2][j][k] + value);
          }
        }
      }
    }
    printf("%d\n", dp[(2 * n - 1) % 2][n][n]);
  }
  return 0;
}
