import qualified Data.ByteString.Char8 as BC
import Data.Maybe
 
readIntsLines :: IO [[Int]]
readIntsLines = map (map (fst . fromJust . BC.readInt) . BC.words) . BC.lines <$> BC.getContents

calc :: [Int] -> [Int] -> [Int]
calc [pa, pb, pc] [ca, cb, cc] = [na, nb, nc]
  where na = max (pb + ca) (pc + ca)
        nb = max (pa + cb) (pc + cb)
        nc = max (pa + cc) (pb + cc)

solve :: [Int] -> [[Int]] -> [[Int]]
solve _ [] = []
solve pabc (cabc:abcs) = nabc : solve nabc abcs
  where nabc = calc pabc cabc

main :: IO ()
main = do
  n <- readLn :: IO Int
  abcs <- readIntsLines
  print . maximum . last $ solve [0,0,0] abcs