read n a b
ans=0
for (( k = 1; k <= n; k++ )); do
    s="${k}0000"
    dsum=$(( ${s:0:1} + ${s:1:1} + ${s:2:1} + ${s:3:1} + ${s:4:1} ))
    (( dsum >= a && dsum <= b )) && (( ans += k ))
done
echo ${ans}
