!全探索
implicit none
INTEGER :: x,a,b,c,count,i,j,k
READ(5,*) a,b,c,x
count = 0

do i=0,a
    do j=0,b
        do k=0,c
            if (x==500*i+100*j+50*k) then
                count = count+1
            endif
        enddo
    enddo
enddo

WRITE(6,*) count

end
