module Main where--
import Control.Monad

solve :: [[Int]] -> Int -> Int -> Int
solve a 0 0 = (a !! 0) !! 0
solve a (-1) _ = 0
solve a _ (-1) = 0
solve a i j = (a !! i) !! j + (max (solve a (i-1) j) (solve a i (j-1)))

main :: IO ()
main = do
        n <- readLn
        a <- map (map read . words) <$> replicateM 2 getLine
--         putStrLn $ show $ (a :: [[Int]])
        putStrLn $ show $ solve a 1 (n-1)
