#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int expo_pow(int x, int y) {
  if (y == 0) return 1;
  y = y % (mod - 1);
  x %= mod;
  if (y == 0) y = mod - 1;
  int res = 1;
  while (y) {
    if (y & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    y >>= 1;
  }
  return res;
}
long long add() { return 0; }
template <typename T, typename... Types>
T add(T var1, Types... var2) {
  return (((((long long)(var1)) % mod + (long long)(add(var2...))) % mod) +
          mod) %
         mod;
}
long long mul() { return 1; }
template <typename T, typename... Types>
T mul(T var1, Types... var2) {
  return (((long long)(var1)) % mod * (long long)(mul(var2...))) % mod;
}
const int mx = 306;
const int inf = 1e9;
int dp[2 * mx][mx][mx];
int n;
bool valid(int x, int y) { return ((x >= 0 and x < n) and (y >= 0 and y < n)); }
void solve() {
  cin >> n;
  int a[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  dp[0][0][0] = a[0][0];
  for (int i = 1; i < 2 * n - 1; i++) {
    for (int x1 = 0; x1 < n; x1++) {
      for (int x2 = 0; x2 < n; x2++) {
        int cur = i;
        int prev = i - 1;
        int y1 = i - x1;
        int y2 = i - x2;
        int val;
        int ans = -inf;
        if (x1 == x2 and y1 == y1)
          val = a[x1][y1];
        else
          val = a[x1][y1] + a[x2][y2];
        if (!valid(x1, y1) || !valid(x2, y2)) continue;
        if (valid(x1 - 1, y1)) {
          if (valid(x2 - 1, y2)) ans = max(ans, val + dp[prev][x1 - 1][x2 - 1]);
          if (valid(x2, y2 - 1)) ans = max(ans, val + dp[prev][x1 - 1][x2]);
        }
        if (valid(x1, y1 - 1)) {
          if (valid(x2 - 1, y2)) ans = max(ans, val + dp[prev][x1][x2 - 1]);
          if (valid(x2, y2 - 1)) ans = max(ans, val + dp[prev][x1][x2]);
        }
        dp[i][x1][x2] = ans;
      }
    }
  }
  cout << dp[2 * n - 2][n - 1][n - 1] << "\n";
}
signed main() {
  int test = 1;
  int i = 1;
  while (test--) {
    solve();
  }
}
