#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long dx[2] = {1, 0};
const long long dy[2] = {0, 1};
const long long MAX = 300;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long n, m, x, y, k, Q, ans;
string second;
int a[2 * MAX], b[2 * MAX];
int dp[2 * MAX][MAX][MAX], cost[MAX][MAX];
int get_j(int d, int i) {
  if (d == 0) return 0;
  if (d == 2 * n - 2) return n - 1;
  return a[d] * i + b[d];
}
bool valid(int oldi, int newi, int j) {
  if (oldi == newi) return j < n - 1;
  return oldi < n - 1;
}
long long solve(int d, int i1, int i2) {
  int j1 = get_j(d, i1);
  int j2 = get_j(d, i2);
  if ((i1 + i2 + j1 + j2) == (4 * n - 4)) return cost[n - 1][n - 1];
  assert(j1 >= 0 && j2 >= 0 && j1 < n && j2 < n);
  int &ret = dp[d][i1][i2];
  if (ret != -1e9) return ret;
  ret = cost[i1][j1] + cost[i2][j2] - (i1 == i2) * cost[i1][j1];
  long long sum = -1e9;
  for (int j = 0; j < 2; ++j)
    for (int k = 0; k < 2; ++k)
      if (valid(i1, i1 + dx[j], j1) && valid(i2, i2 + dx[k], j2))
        sum = max(sum, solve(d + 1, i1 + dx[j], i2 + dx[k]));
  return ret += sum;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) cin >> cost[i][j];
  for (int i = 0; i < 2 * n; ++i)
    for (int j = 0; j < n; ++j)
      for (int k = 0; k < n; ++k) dp[i][j][k] = -1e9;
  int nb = 1;
  for (int i = 1; i < n; ++i) {
    int x1, x2, y1, y2;
    x1 = i - 1;
    y1 = i;
    x2 = i;
    y2 = i - 1;
    a[nb] = (y1 - y2) / (x1 - x2);
    b[nb] = y1 - a[nb] * x1;
    ++nb;
    if (i == n - 1) break;
    x1 = i + 1;
    y1 = i - 1;
    x2 = i - 1;
    y2 = i + 1;
    a[nb] = (y1 - y2) / (x1 - x2);
    b[nb] = y1 - a[nb] * x1;
    ++nb;
  }
  cout << solve(0, 0, 0) << '\n';
  return 0;
}
