#include <bits/stdc++.h>
#pragma GCC optimization("O3")
using namespace std;
template <typename T>
inline void Cin(T& first) {
  char c;
  T sign = 1;
  first = 0;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') sign = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) first = first * 10 + c - '0';
  first *= sign;
}
template <typename T>
inline void Out(T first) {
  if (first > 9) Out(first / 10);
  putchar(first % 10 + '0');
}
template <typename T>
inline void Cout(T first, char c) {
  if (first < 0) putchar('-');
  first = abs(first);
  Out(first);
  putchar(c);
}
template <typename T, typename... Args>
inline void Cin(T& a, Args&... args) {
  Cin(a);
  Cin(args...);
}
template <typename T, typename... Args>
inline void Cout(T a, char c, Args... args) {
  Cout(a, c);
  Cout(args...);
}
const int N = 307;
int n, a[N][N], f[N][N][N];
void Enter() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) cin >> a[i][j];
  }
}
bool Inside(int first, int second) {
  return first >= 1 && first <= n && second >= 1 && second <= n;
}
int DP(int first, int second, int p) {
  if (f[first][second][p] != -1) return f[first][second][p];
  if (first == n && second == n && p == n)
    return f[first][second][p] = a[first][second];
  int q = first + second - p;
  if (!Inside(first, second) || !Inside(p, q)) return f[first][second][p] = 0;
  int res = int(-1e9);
  if (first + 1 <= n) {
    if (p + 1 <= n) res = max(res, DP(first + 1, second, p + 1));
    if (q + 1 <= n) res = max(res, DP(first + 1, second, p));
  }
  if (second + 1 <= n) {
    if (p + 1 <= n) res = max(res, DP(first, second + 1, p + 1));
    if (q + 1 <= n) res = max(res, DP(first, second + 1, p));
  }
  res += a[first][second] + a[p][q];
  if (first == p) res -= a[first][second];
  return f[first][second][p] = res;
}
void Solve() {
  memset(&f, -1, sizeof f);
  cout << DP(1, 1, 1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (fopen("test"
            ".inp",
            "r")) {
    freopen(
        "test"
        ".inp",
        "r", stdin);
    freopen(
        "test"
        ".out",
        "w", stdout);
  }
  Enter(), Solve();
  return 0;
}
