n = gets.to_i
dp = Array.new(n){Array.new(n){Array.new(n){0}}}

mat = []
n.times{|i|
  mat[i] = gets.split.map(&:to_i)
  dp[0][i] = mat[i].dup
}

n.times{|i|
  n.times{|j|
    n.times{|k|
      break if k+i+1 >= n
      dp[i+1][j][k] = dp[i][j][k] + mat[j][k+i+1]
    }
  }
}
max = dp[0][0][0]
n.times{|k|
  n.times{|j|
    next if j + k >= n
    the_max = dp[k][0][j]
    1.upto(n-1){|i|
      x = dp[k][i][j]
      the_max = [x, the_max + x].max
      max = [max, the_max].max
    }
  }
}
puts max