import Data.List rInt :: String -> Int rInt = read allStones x y = x * 2 + y solve xs | all (< 3) xs && elem 0 xs = [0,0,0] | elem 0 xs = solve $ sort $ elaseZero xs | otherwise = xs where elaseZero [x,y,z] = [1 , y, (z - 2)] main = do stones <- solve . sort . map rInt . words <$> getLine print $ foldr allStones (last stones) (init stones) `div` 5