#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9 + 7;
int n, a[305][305], f[305][305][605];
int solve(int x1, int x2, int time) {
  int y1 = time - (x1 - 1);
  int y2 = time - (x2 - 1);
  if (x1 > n || y1 > n || x2 > n || y2 > n) return -oo;
  if (x1 == n && y1 == n && x2 == n && y2 == n) return a[n][n];
  if (f[x1][x2][time] != -1) return f[x1][x2][time];
  int cur = -oo, plus = 0;
  if (x1 == x2 && y1 == y2)
    plus = a[x1][y1];
  else
    plus = a[x1][y1] + a[x2][y2];
  cur = max(cur, solve(x1, x2 + 1, time + 1) + plus);
  cur = max(cur, solve(x1 + 1, x2, time + 1) + plus);
  cur = max(cur, solve(x1, x2, time + 1) + plus);
  cur = max(cur, solve(x1 + 1, x2 + 1, time + 1) + plus);
  return f[x1][x2][time] = cur;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  memset(f, -1, sizeof f);
  cout << solve(1, 1, 1);
  return 0;
}
