import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Array

main = do
    n<-readLn::IO Int
    abcs<-replicateM n $ unfoldr (B.readInt.B.dropWhile(==' '))<$>B.getLine::IO[[Int]]

    print $ f n abcs

f n abcs = maximum $ dp ! n
    where
    dp = array (0,n) $ (0,[0,0,0]):zipWith proc [1..] abcs
    proc i [a,b,c] = (i, [max (v+b) (w+c), max (u+a) (w+c), max (u+a) (v+b)])
        where
        [u,v,w] = dp ! (i-1)
