let main () =
  let a = Scanf.scanf "%d\n" Batteries.identity in
  let b = Scanf.scanf "%d\n" Batteries.identity in
  let c = Scanf.scanf "%d\n" Batteries.identity in
  let x = Scanf.scanf "%d\n" Batteries.identity in
  let xs = ref [] in
  for i = 0 to a do
    for j = 0 to b do
      for k = 0 to c do
        xs := (a,b,c) :: !xs;
      done
    done
  done;
  let count = List.fold_left (fun acc (a,b,c) -> if 500 * a + 100 * b + 50 * c = x then acc + 1 else acc) 0 !xs in
  Printf.printf "%d\n" count

let _ = main ()
