let [|A;B;C;X|] =
    [|1..4|]
    |> Array.map (fun _ ->
        stdin.ReadLine()
        |> int)

Array.allPairs [|0..B|] [|0..C|]
|> Array.allPairs [|0..A|]
|> Array.fold (fun state (a,(b,c)) ->
    match 500*a+100*b+50*c with
    | x when x=X -> state+1
    | _ -> state) 0
|> stdout.WriteLine