n = gets.to_i
sum = Array.new(n+1){ Array.new(n+1,0) }
n.times do |i|
  l = gets.split.map(&:to_i)
  n.times do |j|
    sum[i+1][j+1] += sum[i+1][j] + l[j]
  end
end
n.times do |i|
  n.times do |j|
    sum[j+1][i+1] += sum[j][i+1]
  end
end
ret = 0
(0..n).each do |i|
  (0..n).each do |j|
    (i..n).each do |k|
      (j..n).each do |l|
        x = sum[k][l] - sum[i][l] - sum[k][j] + sum[i][j]
        ret = x if x > ret
      end
    end
  end
end
p ret