read n a b
ans=0
for (( k = 1; k <= n; k++ )); do
    sum=$(( (k / 10000) % 10 + (k / 1000) % 10 + (k / 100) % 10 + (k / 10) % 10 + k % 10 ))
    (( sum >= a && sum <= b )) && (( ans += k ))
done
echo ${ans}
