read A
read B
read C
read X

count=0

for (( a = 0; a <= A; a++ )); do
    for (( b = 0; b <= B; b++ )); do
        c=$(( (X - a * 500 + b * 100) / 50 ))
        (( c >= 0 && c <= C )) && count=$(( count + 1 ))
    done
done

echo ${count}
