#include <bits/stdc++.h>
using namespace std;
const int N = 305;
int n, a[N][N], dp[N + N][N][N];
int rec(int x1, int y1, int x2, int y2) {
  if (x1 > n || y1 > n || x2 > n || y2 > n) return -(int)1e9;
  if (x1 == x2 && y1 == y2 && x1 == n && y1 == n) return a[n][n];
  if (dp[x1 + y1][x1][x2] != -(int)1e9) return dp[x1 + y1][x1][x2];
  int z = -(int)1e9, w = 0;
  z = max(z, rec(x1 + 1, y1, x2 + 1, y2));
  z = max(z, rec(x1 + 1, y1, x2, y2 + 1));
  z = max(z, rec(x1, y1 + 1, x2 + 1, y2));
  z = max(z, rec(x1, y1 + 1, x2, y2 + 1));
  w = a[x1][y1];
  if (x1 != x2 || y1 != y2) w += a[x2][y2];
  return dp[x1 + y1][x1][x2] = w + z;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) cin >> a[i][j];
  for (int i = 1; i <= n + n; ++i)
    for (int j = 1; j <= n; ++j)
      for (int k = 1; k <= n; ++k) dp[i][j][k] = -(int)1e9;
  cout << rec(1, 1, 1, 1);
}
