n, m = gets.split.map &:to_i x, y = 0, 0 (1..n).map do a = gets.split.sum &:to_i x, y = [x, y + a].max, [y, x - a].max end puts [x, y].max