import scala.io.StdIn._
import scala.math._
object Main{
    def main(args: Array[String]): Unit = {
        lazy val n = readInt
        var map = Array.ofDim[Int](n + 1, n + 1)
        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)
        }
        var max = map(1)(1)
        for(i <- 1 to n ;j <- 1 to n;k <- i to n;l <- j to n) max = math.max(max,map(k)(l) + map(i - 1)(j - 1) - map(i - 1)(l) - map(k)(j - 1))   
        
        
        
        println(max)
  }
}