coins :: Int -> Int-> [Int]
coins x n = map (* x) [0..n]

yens :: Int -> Int-> Int -> [Int]
yens a b c = [x + y + z | x <- coins 500 a, y <- coins 100 b, z <- coins 50 c]

main :: IO ()
main = do
    a <- readLn
    b <- readLn
    c <- readLn
    x <- readLn
    print $ length $ filter (== x) $ yens a b c