A = (1..N=gets.to_i).map {gets.split.map &:to_i}
l=t=s = 0
A.each {|a|
  a[l] += s - d=t
  a.each.with_index {|v,i|
    v += d
    if v > s
      if v > t
        s,t,l = t,v,i
      else
        s = v
      end
    end
  }
}
p t