#include <bits/stdc++.h>
using namespace std;
const int oo = 0x7fffffff;
int a[310][310];
int dp[2][310][310];
int dir[2][2] = {-1, 0, 0, -1};
int n;
bool sure(int x, int y) { return x >= 1 && x <= n && y >= 1 && y <= n; }
void update(int &x, int y) {
  if (x < y) x = y;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) dp[0][i][j] = -oo;
  dp[0][1][1] = a[1][1];
  for (int i = 3; i <= 2 * n; i++) {
    int flag = i & 1;
    for (int j = 1; j < i && j <= n; j++) {
      for (int k = 1; k < i && k <= n; k++) {
        dp[flag][j][k] = -oo;
        int x1 = j, y1 = i - x1;
        int x2 = k, y2 = i - x2;
        for (int r = 0; r < 2; r++) {
          int xx1 = x1 + dir[r][0];
          int yy1 = y1 + dir[r][1];
          if (!sure(xx1, yy1)) continue;
          for (int p = 0; p < 2; p++) {
            int xx2 = x2 + dir[p][0];
            int yy2 = y2 + dir[p][1];
            if (!sure(xx2, yy2)) continue;
            if (x1 == x2)
              update(dp[flag][j][k], dp[1 - flag][xx1][xx2] + a[x1][y1]);
            else
              update(dp[flag][j][k],
                     dp[1 - flag][xx1][xx2] + a[x1][y1] + a[x2][y2]);
          }
        }
      }
    }
  }
  printf("%d\n", dp[0][n][n]);
  return 0;
}
