let get_4_ints () = Scanf.scanf "%d %d %d %d" (fun u v w x -> u,v,w,x)
module Rep = struct
	let __range ?(stride=1) u v =
		let rec f0 i = if i>v then [] else i::(f0 (i+stride))
    in f0 u
  let __ls_product l r =
    List.map (fun u -> List.map (fun v -> u,v) r) l
    |> List.concat
	let init f = f ()
	let rep ?(stride=1) f t = __range ~stride f t
	let (=+>) v p = (v,p)
	let (=>) (v,p) q = (v,__ls_product p q)
	let (=>>) (v,p) f = List.fold_left (fun x y -> f x y) v p
end

let () = 
  let (a,b,c,x) = get_4_ints ()
  in let open Rep in
  init (fun () -> 0)
  =+> rep 0 a => rep 0 b => rep 0 c =>>
  (fun a ((u,v),w) -> if u*500+v*100+w*50=x then a+1 else a)
  |> Printf.printf "%d\n"