import Control.Applicative ((<$>)) import Data.List (sort) main :: IO () main = solve <$> map read <$> words <$> getLine >>= print solve :: [Int] -> Int solve xs = bsearch (judge (a, b, c)) a c where [a, b, c] = sort xs bsearch :: (Int -> Bool) -> Int -> Int -> Int bsearch f o n | n - o <= 1 = o | f m = bsearch f m n | otherwise = bsearch f o m where m = (o + n) `div` 2 judge :: (Int, Int, Int) -> Int -> Bool judge (a, b, c) m = (m > b && 2*m - a - b <= (c - m) `div` 2) || (m <= b && m - a <= (b - m) `div` 2 + (c - m) `div` 2)