import qualified Data.ByteString.Char8 as B
import Data.List
readInt :: B.ByteString -> Int
readInt s = let Just (n,_) = B.readInt s in n
main :: IO ()
main = do
    _ <- getLine 
    params <- fmap (map (map readInt. B.words) . B.lines) B.getContents 
    let (ha_end,hb_end,hc_end) = foldl' step s0 params
        step (ha,hb,hc) [ai,bi,ci] = (ha', hb', hc')
            where ha' = ai + max hb hc
                  hb' = bi + max ha hc
                  hc' = ci + max ha hb
        s0 = (0, 0, 0)
    print (maximum [ha_end,hb_end,hc_end] :: Int)
    
