module global_variables
  integer,parameter::max_n = 50
  integer s(0:max_n,0:max_n,0:max_n)
end module global_variables
program main
  use global_variables
  implicit none
  integer a,b,c,x,res
  integer i,j,k
  read *, a,b,c,x
  s = 0
  forall (i=0:a,j=0:b,k=0:c) s(i,j,k) = i*500 + j*100 + k*50
  print '(i0)', count(s == x)
end program main
