main = do
  inputs <- getContents
  let n = read $ head . lines $ inputs :: Int
  let ps = map tail $ map (\xs -> map read (words xs)) $ take n $ reverse $ lines inputs :: [[Int]]

  print $ sum $ map maximum ps