#include <bits/stdc++.h>
using namespace std;
int dp[0x12d * 2][0x12d][0x12d];
int v[0x12d][0x12d];
int max(int a, int b, int c, int d) {
  if (a < b) a = b;
  if (a < c) a = c;
  if (a < d) a = d;
  return a;
}
int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= N; ++j) scanf("%d", v[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] = -0x80000000;
  dp[1][1][1] = v[1][1];
  for (int i = 2; i <= N; ++i)
    for (int j = 1; j <= i; ++j) {
      dp[i][j][j] =
          v[i + 1 - j][j] + max(dp[i - 1][j - 1][j - 1], dp[i - 1][j - 1][j],
                                dp[i - 1][j][j - 1], dp[i - 1][j][j]);
      for (int k = j + 1; k <= i; ++k)
        dp[i][j][k] = v[i + 1 - j][j] + v[i + 1 - k][k] +
                      max(dp[i - 1][j][k], dp[i - 1][j - 1][k],
                          dp[i - 1][j][k - 1], dp[i - 1][j - 1][k - 1]);
    }
  for (int i = N + 1; i < 2 * N; ++i)
    for (int j = i + 1 - N; j <= N; ++j) {
      dp[i][j][j] =
          v[i + 1 - j][j] + max(dp[i - 1][j - 1][j - 1], dp[i - 1][j - 1][j],
                                dp[i - 1][j][j - 1], dp[i - 1][j][j]);
      for (int k = j + 1; k <= N; ++k)
        dp[i][j][k] = v[i + 1 - j][j] + v[i + 1 - k][k] +
                      max(dp[i - 1][j][k], dp[i - 1][j - 1][k],
                          dp[i - 1][j][k - 1], dp[i - 1][j - 1][k - 1]);
    }
  cout << dp[2 * N - 1][N][N] << '\n';
  return 0;
}
