(defn coins [A,B,C,X](count (filter #(= X(reduce + %)) (for [a (map #(* 500 %) (range (inc A))) b (map #(* 100 %) (range (inc B))) c (map #(* 50 %) (range (inc C)))] [a b c]))))
(println (coins (bigint (read-line)) (bigint (read-line)) (bigint (read-line)) (bigint (read-line))))