read n a b

total=0

for ((i=1 ; i<=$n ; i++));do
    len=${#i}
    sum=0
    for ((j=1 ; j<=$len ; j++));do
        num=$(echo $i | cut -c $j)
        sum=$(($sum + $num))
    done
    if [ $sum -le $b -a $sum -ge $a ] ; then
            total=$(($total + $i))
    fi

done

echo $total