main :: IO ()
main = do
    [a,b,c,x] <- map read . words <$> getContents
    print $ calc a b c x

calc :: Int -> Int -> Int -> Int -> Int
calc a b c x = length $ pairs a b c x

pairs :: Int -> Int -> Int -> Int -> [(Int,Int,Int)]
pairs a b c x = [(na,nb,nc) | na <- [0..a]
                            , nb <- [0..b]
                            , nc <- [0..c]
                            , exact na nb nc x]

exact :: Int -> Int -> Int -> Int -> Bool
exact a b c x = 500 * a + 100 * b + 50 * c == x
