read A
read B
read C
read X
{
N=0
for AI in `seq 0 $A`
do
        if [[ $X -ge $((500*$AI)) ]]; then
                AM=$(( $X-(500*$AI) ))
                for BI in `seq 0 $B`
                do
                        if [[ $AM -ge $((100*$BI)) ]]; then
                                BM=$(( $AM-(100*$BI) ))
                                for CI in `seq 0 $C`
                                do
                                        if [[ $(($BM-50*$CI)) = 0 ]]; then
                                                N=$((++N))
                                        fi
                                done
                        fi
                done
        fi
done
echo $N
}