read n a b
ans=0
seq -f %05g 1 $n \
    | sed -e's/\(.\)\(.\)\(.\)\(.\)\(.\)/& + ( \1 + \2 + \3 + \4 + \5 + 100 ) * 100000/' \
    | xargs -L1 expr \
    | sort -n \
    | fgrep -A $n $((100 + a)) \
    | fgrep -B $n $((100 + b)) \
    | cut -c 4-9 \
    | sed -e's/^/+ /' \
    | xargs expr 0
