import           Control.Monad
import qualified Data.Array.IO               as AM
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Maybe
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

main = do
  n <- getInt

  as <- VM.new n
  bs <- VM.new n
  cs <- VM.new n
  forM_ [0..n-1] $ \i -> do
    [a, b, c] <- getIntList
    VM.write as i a
    VM.write bs i b
    VM.write cs i c

  dp <- AM.newArray ((0,0),(n-1,2)) 0 :: IO (AM.IOUArray (Int,Int) Int)

  a0 <- VM.read as 0
  b0 <- VM.read bs 0
  c0 <- VM.read cs 0
  AM.writeArray dp (0,0) a0
  AM.writeArray dp (0,1) b0
  AM.writeArray dp (0,2) c0

  forM_ [1..n-1] $ \i -> do
    ai <- VM.read as i
    bi <- VM.read bs i
    ci <- VM.read cs i
    dp0 <- AM.readArray dp (i-1, 0)
    dp1 <- AM.readArray dp (i-1, 1)
    dp2 <- AM.readArray dp (i-1, 2)
    AM.writeArray dp (i,0) (max dp1 dp2 + ai)
    AM.writeArray dp (i,1) (max dp2 dp0 + bi)
    AM.writeArray dp (i,2) (max dp0 dp1 + ci)

  dp0 <- AM.readArray dp (n-1, 0)
  dp1 <- AM.readArray dp (n-1, 1)
  dp2 <- AM.readArray dp (n-1, 2)

  let ans = max dp0 (max dp1 dp2)
  print ans