program B087
    implicit none
    integer(8) :: A, B, C, X
    integer(8) :: i, j, k, sum

    read(5,*) A
    read(5,*) B
    read(5,*) C
    read(5,*) X

    sum = 0
    do i = 0, A
        do j = 0, B
            do k = 0, C
                if (500*i+100*j+50*k == X) then
                    
                    sum = sum + 1
                end if

            end do
        end do
    end do

    write(6,*) sum


end program B087
