program main
   integer, allocatable :: s(:, :, :)
   read(*, *)ia, jb, kc, ix
   allocate(s(0:ia, 0:jb, 0:kc))
   forall(i=0:ia, j=0:jb, k=0:kc) s(i, j, k) = i*500 + j*100 + k*50
   write(*, *) count(s == ix)
   deallocate(s)
end