#include <bits/stdc++.h>
using namespace std;
const int INF = 1E9;
int n;
int cost[400][400];
int DP[650][320][320];
int f(int l, int b1, int b2) {
  if (b1 == n || b2 == n || l - b1 >= n || l - b2 >= n || l - b1 < 0 ||
      l - b2 < 0)
    return INF * -1;
  if (l == n + n - 2 && b1 == n - 1 && b2 == n - 1) return cost[n - 1][n - 1];
  int &ret = DP[l][b1][b2];
  if (ret != INF * -1) return ret;
  if (b1 == b2)
    ret = max(max(f(l + 1, b1, b2), f(l + 1, b1 + 1, b2 + 1)),
              max(f(l + 1, b1 + 1, b2), f(l + 1, b1, b2 + 1))) +
          cost[b1][l - b1];
  else
    ret = max(max(f(l + 1, b1, b2), f(l + 1, b1 + 1, b2 + 1)),
              max(f(l + 1, b1 + 1, b2), f(l + 1, b1, b2 + 1))) +
          cost[b1][l - b1] + cost[b2][l - b2];
  return ret;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> cost[i][j];
    }
  }
  for (int i = 0; i < 650; i++) {
    for (int j = 0; j < 320; j++) {
      for (int k = 0; k < 320; k++) {
        DP[i][j][k] = INF * -1;
      }
    }
  }
  cout << f(0, 0, 0) << endl;
  return 0;
}
