import scala.io.StdIn._
import scala.math._
object Main{
	var max:Int = Int.MinValue
	def main(args: Array[String]): Unit = {
		var n = readInt
		var map = Array.ofDim[Int](n + 1, n + 1)
		var max = -2000000000
		for(i <- 1 to n){
			  var temp = readLine.split(" ").map(_.toInt)
		    for(j <- 1 to n)map(i)(j) = map(i)(j - 1) + map(i - 1)(j) -  map(i - 1)(j - 1) + temp(j - 1)
		}
		for(i <- 1 to n ;j <- 1 to n;k <- 1 to n;l <- 1 to n){
			max = math.max(max, map(k)(l) + map(i-1)(j-1) - map(i-1)(l) - map(k)(j-1))
		}
		println(max)
  }
}