#include <bits/stdc++.h>
using namespace std;
int a[303][303], dp[602][301][301], n;
bool valid(int x, int y) { return (x >= 0 && x < n && y >= 0 && y < n); }
int update(int d, int x1, int x2) {
  if (x2 < x1) swap(x1, x2);
  int y1 = d - x1, y2 = d - x2;
  if (!valid(x1, y1) || !valid(x2, y2)) return INT_MIN;
  if (dp[d][x1][x2] != INT_MIN) return dp[d][x1][x2];
  for (long long mask = 0; mask < 4; mask++) {
    dp[d][x1][x2] = max(dp[d][x1][x2],
                        update(d - 1, x1 - (mask & 1), x2 - ((mask & 2) >> 1)));
  }
  if (dp[d][x1][x2] == INT_MIN) dp[d][x1][x2] = 0;
  dp[d][x1][x2] += a[x1][y1] + (x1 != x2 ? a[x2][y2] : 0);
  return dp[d][x1][x2];
}
int main() {
  cin >> n;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) cin >> a[i][j];
  for (long long i = 0; i < 2 * n; i++)
    for (long long j = 0; j < n; j++)
      for (long long k = 0; k < n; k++) dp[i][j][k] = INT_MIN;
  cout << update(2 * n - 2, n - 1, n - 1) << endl;
  return 0;
}
