import Control.Monad
import Data.Int

util :: (a -> b -> c) -> (a,b) -> c
util f (a',b') = f a' b'

mysum :: [Int64] -> Int64 -> Int64 -> Int -> Int64
mysum array _sum _max skipCount =
    let _array = drop skipCount array in
    if null _array
    then
        _max
    else
        let (x:xs) = _array in
        let _next_sum = _sum + x in
        let _next_max = max _max _next_sum in
        mysum  xs _next_sum _next_max skipCount


main :: IO ()
main = do 
    line <- getLine
    line2 <- getLine
    let sarray = map read $ words line2 :: [Int64]
    let n = length sarray
    let rarray = reverse sarray
    let n2 = div n 2
    let array =  drop 1 $ take n2 $ zipWith (+) sarray rarray

    let results = map (mysum array 0 0) [0..n2]

    print $ maximum results

    

