read n a b

for i in $(seq $n); do
    x=$(echo $i | sed 's/./&+/g;s/+$//g' | bc)
    if [ $a -le $x -a $x -le $b ]; then
        echo $i
    else
        echo 0
    fi
done |
awk '{sum+=$1} END{print sum}'
