let ans = ref 0
let _ = Scanf.scanf "%d %d %d %d" @@ fun a b c x -> for i = 0 to a do for j = 0 to b do for k = 0 to c do if 500 * i + 100 * j + 50 * k = x then incr ans done done done; Printf.printf "%d\n" !ans