import Data.Array
import Control.Monad

makeDPTable :: Int -> Int -> Array Int [Int] -> [[Int]] -> [[Int]]
makeDPTable n i abcList ans
 | i == 0    = makeDPTable n (i + 1) abcList $ (abcList ! 0):ans
 | i == n    = ans
 | otherwise = makeDPTable n (i + 1) abcList $ newAns:ans
   where newAns0 = ((abcList ! i) !! 0) + (max ((head ans) !! 1) ((head ans) !! 2))
         newAns1 = ((abcList ! i) !! 1) + (max ((head ans) !! 0) ((head ans) !! 2))
         newAns2 = ((abcList ! i) !! 2) + (max ((head ans) !! 0) ((head ans) !! 1))
         newAns  = [newAns0, newAns1, newAns2]

getABCList = map read . words <$> getLine :: IO [Int]

main = do
 n <- read <$> getLine :: IO Int
 abcList <- replicateM n getABCList
 print $ maximum $ head (makeDPTable n 0 (listArray (0, n - 1) abcList) [])
