let rec seq a b = if a > b then [] else a :: seq (a+1) b
let (>>=) x f = List.map f x |> List.concat
let () =
  Scanf.scanf "%d %d %d %d" @@ fun a b c x ->
    (seq 0 a >>= fun i ->
     seq 0 b >>= fun j ->
     seq 0 c >>= fun k ->
       [if 500*i + 100*j + 50*k = x then 1 else 0])
    |> List.fold_left (+) 0
    |> Printf.printf "%d\n"