import Data.Bifunctor (bimap, first)
import Data.Maybe     (fromJust, fromMaybe, listToMaybe)

main :: IO ()
main = do
    [n, e, t] <- fmap read . words <$> getLine
    xs        <- fmap read . words <$> getLine
    answer $ solve e t xs

type Answer = Int
answer :: Answer -> IO ()
answer = print

solve :: Int -> Int -> [Int] -> Answer
solve e t = go
  where
    go = negate . fromJust . inner (Just (-e), Nothing) []

    inner dp js      []  = fst dp
    inner dp js (i : is) = inner (x, y) js' is
      where
        p   = i - succ t `div` 2
        js' = dropWhile ((p >=) . fst) js ++ [(i, dp)]
        l   = snd <$> listToMaybe (init js')
        x   = max `uncurry` bimap (?- t) (?- 2 * i) (fromMaybe dp l)
        y   = max `uncurry` first (?+ 2 * i) dp

m ?+ x = (x +) <$> m
m ?- x = subtract x <$> m
infixl 6 ?+, ?-
