read n a b

total=0

for ((i=1 ; i<=$n ; i++));do
    len=${#i}
    sum=0
    for (( j = 0; j < ${#i}; j++ )); do
        (( sum += ${i:j:1} ))
    done

    if [ $sum -le $b -a $sum -ge $a ] ; then
            total=$(($total + $i))
    fi

done

echo $total