import Data.Array
import Data.List

main = do
    n <- read <$> getLine :: IO Int
    ns <- listArray ((1,1), (2,n)) . map read . words <$> getContents :: IO (Array (Int, Int) Int)
    print $ dp ns

dp :: Array (Int, Int) Int -> Int
dp ns = memo!(1,1)
    where
    (_,(_,xe)) = bounds ns
    memo = array ((1,1),(2,xe)) [((y,x), f y x)|x<-reverse [1..xe],y<-[2,1]]
    f y x
        | y==2 && x==xe = ns!(2,xe)
        | y==2          = memo!(2,x+1) + ns!(2,x)
        | y==1 && x==xe = memo!(2,xe)  + ns!(1,xe)
        | otherwise     = max (memo!(y,x+1)) (memo!(y+1,x)) + ns!(y,x)

    