#include <bits/stdc++.h>
using namespace std;
const int nax = 301;
const double pi = acos(-1);
const double eps = 1e-10;
int C[nax][nax];
int dp[602][nax][nax];
int n;
const int inf = 1e9;
int go(int d, int i1, int i2) {
  if (d == 2 * (n - 1)) return C[n - 1][n - 1];
  int j1 = d - i1;
  int j2 = d - i2;
  int &r = dp[d][i1][i2];
  if (r != inf) return r;
  r = -1e8;
  if (i1 + 1 < n) {
    if (i2 + 1 < n) {
      r = max(r, go(d + 1, i1 + 1, i2 + 1));
    }
    if (j2 + 1 < n) {
      r = max(r, go(d + 1, i1 + 1, i2));
    }
  }
  if (j1 + 1 < n) {
    if (i2 + 1 < n) {
      r = max(r, go(d + 1, i1, i2 + 1));
    }
    if (j2 + 1 < n) {
      r = max(r, go(d + 1, i1, i2));
    }
  }
  if (i1 == i2) {
    r = r + C[i1][j1];
  } else {
    r = r + C[i1][j1] + C[i2][j2];
  }
  return r;
}
void build(int d, int i1, int i2) {
  if (d == 2 * (n - 1)) {
    cout << "\"mkaa\""
         << " "
         << "mkaa" << '\n';
    return;
  }
  int j1 = d - i1;
  int j2 = d - i2;
  int &r = dp[d][i1][i2];
  int cost = 0;
  if (i1 == i2) {
    cost = C[i1][j1];
  } else {
    cost = C[i1][j1] + C[i2][j2];
  }
  cout << "cost"
       << " " << cost << '\n';
  if (i1 + 1 < n) {
    if (i2 + 1 < n) {
      if (r == cost + go(d + 1, i1 + 1, i2 + 1)) {
        cout << d + 1 << " " << i1 + 1 << " " << i2 + 1 << '\n';
        build(d + 1, i1 + 1, i2 + 1);
        return;
      }
    }
    if (j2 + 1 < n) {
      if (r == cost + go(d + 1, i1 + 1, i2)) {
        cout << d + 1 << " " << i1 + 1 << " " << i2 << '\n';
        build(d + 1, i1 + 1, i2);
        return;
      }
    }
  }
  if (j1 + 1 < n) {
    if (i2 + 1 < n) {
      if (r == cost + go(d + 1, i1, i2 + 1)) {
        cout << d + 1 << " " << i1 << " " << i2 + 1 << '\n';
        build(d + 1, i1, i2 + 1);
        return;
      }
    }
    if (j2 + 1 < n) {
      r = max(r, go(d + 1, i1, i2));
      if (r == cost + go(d + 1, i1, i2)) {
        cout << d + 1 << " " << i1 << " " << i2 << '\n';
        build(d + 1, i1, i2);
        return;
      }
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << setprecision(20) << fixed;
  cin >> n;
  for (int i = 0; i < (int)n; ++i) {
    for (int j = 0; j < (int)n; ++j) {
      cin >> C[i][j];
      for (int k = 0; k < (int)602; ++k) {
        dp[k][i][j] = inf;
      }
    }
  }
  cout << go(0, 0, 0) << '\n';
}
