Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).

-----Constraints-----
 - 1 \leq N \leq 10^4
 - 1 \leq A \leq B \leq 36
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
N A B

-----Output-----
Print the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).

-----Sample Input-----
20 2 5

-----Sample Output-----
84

Among the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.

Difficulty: introductory

Starter code:

Solutions:
n, a, b = map(int, input().split())

ans = 0
for i in range(1, n + 1):
    val = 0
    for c in str(i):
        val += int(c)
    if a <= val <= b:
        ans += i
print(ans)

N,A,B = list(map(int,input().split()))
K = 0
for i in range(1,N+1):
  if A <= sum(map(int,str(i))) <= B:
    K += i
print(K)
    



n, a, b = (int(i) for i in input().split())
ans = 0
for i in range(1, n + 1):
    str_i = str(i)
    sum_i = 0
    for j in str_i:
        sum_i += int(j)
    if a <= sum_i <= b:
        ans += i
print(ans)

n, a, b = list(map(int, input().split()))

ans = 0
for num in range(1, n+1):
    p = num
    digit_sum = 0
    while p > 0:
        digit_sum += p % 10
        p //= 10
    if a<= digit_sum <= b:
        ans += num
print(ans)


n,a,b = list(map(int, input().split()))
def sum_digit(x):
    s = 0
    while x:
        s += x % 10
        x //= 10
    return s
print(sum([i for i in range(1,n+1) if a <= sum_digit(i) <= b]))

n, a, b = map(int, input().split())
r = 0
for i in range(n + 1):
    c = 0
    j = i
    for k in range(5):
        c += j % 10
        j = j//10
    if a <= c and c <= b:
        r += i

    
print(r)

N, A, B = map(int, input().split())

def caluculate(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = n // 10
    return sum

ans = 0
for i in range(N+1):
    if A <= caluculate(i) <= B:
        ans += i

print(ans)

n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
    s = str(i)
    sum = 0
    for j in s:
        t = int(j)
        sum+=t
    if a <= sum <= b:
        ans +=i
print(ans)

# coding: utf-8
# Your code here!

n, a, b = map(int, input().split())
sum = 0

for i in range(1, n+1) : 
    tmp_sum = 0
    for j in str(i) : 
        tmp_sum += int(j)
    if a <= tmp_sum and tmp_sum <= b : 
        sum += i
        
print(sum)

def myfunc(A, B):
    def resfunc(x):
        if A <= sum(map(int,list(str(x)))) <=B:
            return x
        else:
            return 0
    return resfunc

N, A, B = map(int, input().split())
print(sum(map(myfunc(A,B), range(1, N+1))))

n, a, b = map(int, input().split())

ans = 0
for i in range(1,n+1):
    w = sum(list(map(int, list(str(i)))))
    if a <= w and w <= b:
        ans += i
print(ans)

s=list(map(int,input().split()))

oklist=[]

def keta(x):
    ketalist=[]
    for j in range(len(x)):
        ketalist.append(int(x[j]))
    return(sum(ketalist))
        
    

for i in range(s[0]+1):
    check=keta(str(i))
    if(s[1]<=check and check<=s[2]):
        oklist.append(i)     
sum_=sum(oklist)
print(sum_)

N,A,B = list(map(int,input().split()))

ans=0

for i in range(1,N+1):
    sum_all=0
    tmp=i
    while(tmp>9):
        sum_all += tmp%10
        tmp//=10
    sum_all += tmp

    if sum_all>=A and sum_all<=B:
        ans+=i
        # print(i)

print(ans)


n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)

N,A,B=map(int,input().split())
X=[]
for i in range(1,N+1):
  if A<= sum(list(map(int,str(i)))) <=B:
    X.append(i)
print(sum(X))

def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, a, b = Input()
    n += 1
    data = (i
            for i in range(1, n)
            if a <= sum(map(int, list(str(i)))) <= b
            )
    print(sum(data))


main()

N, A, B = map(int, input().split())

L = []
for i in range(1, N+1):
    j = map(int, list(str(i)))
    if A <= sum(j) <= B:
        L.append(i)
print(sum(L))

from sys import stdin
n, a, b = [int(x) for x in stdin.readline().rstrip().split()]
sum = 0

for x in range(1,n+1):
   l = x // 10000
   m = (x % 10000) // 1000
   n = (x % 1000) // 100
   o = (x % 100) // 10
   p = x % 10
   if l+m+n+o+p >= a and l+m+n+o+p <= b:
      sum += x

print(sum)

N, A, B = map(int, input().split())
sum_1 = 0
for i in range(1,N+1):
    sum_order = 0
    i_str = str(i)
    n = len(i_str)
    for j in range(0,n):
        sum_order += int(i_str[j])
    if A <= sum_order <= B:
        sum_1 += i
print(sum_1)

N, A, B = map(int, input().split())
lst = []
for i in range(N+1):
    if i >= 1 and i < 10:
        if i >= A and i <= B:
            lst.append(i)
    elif i < 100:
        s = i // 10 + i % 10
        if s >= A and s <= B:
            lst.append(i)
    elif i < 1000:
        t = i // 100 + (i % 100) // 10 + i % 10
        if t >= A and t <= B:
            lst.append(i)
    elif i < 10000:
        u = i // 1000 + (i % 1000) // 100 + (i % 100) // 10 + i % 10
        if u >= A and u <= B:
            lst.append(i)
    elif i == 10000:
        lst.append(i)

lst_sum = sum(lst)
print(lst_sum)

n,a,b=map(int,input().split())
total=0
for i in range(1,n+1):
    x=(str(i))
    j=0
    total2=0
    for j in range(len(x)):
        total2+=int(x[j])
    if a<=total2<=b:
        total+=i
print(total)

n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
    l = len(str(i))
    total = 0
    for j in range(1,l+1):
        total += int(str(i)[-j])
    if a <= total and total <= b:
        ans += i
print(ans)

n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
    l = list(map(int,str(i)))
    sum_l = sum(l)
    if sum_l >= a and sum_l <= b:
        ans += i

print(ans)

def reverse(num):
    sum1 = 0
    while (num > 0):
        remainder = num % 10
        sum1 = remainder+sum1
        num = num // 10
    return sum1

n,a,b = list(map(int,input().split()))
c = 0
for i in range(1,n+1):
    if reverse(i)>=a and reverse(i)<=b:
        c+=i
print(c)



# Press the green button in the gutter to run the script.
def __starting_point():
    n, a, b = list(map(int, input().split()))

    ans = 0
    for n in range(n + 1):
        keta = len(str(n))
        wa = 0
        for m in range(keta):
            tmp = str(n)
            wa = wa + int(tmp[-m-1])
        if a <= wa <= b:
            ans = ans + n

    print(ans)

__starting_point()

N,A,B=list(map(int, input().split()))
s=0
for i in range(1,N+1):
    k=0
    j=i
    while(j>0):
        k+=j%10
        j=j//10
    if (A<=k and k<=B):
        s=s+i
print(s)


N,A,B = map(int,input().split())

ans = 0

for i in range(1,N+1):
  
  x = str(i)
  n = len(x)
  sum = 0
  
  for j in range(0,n):
    sum = sum + int(x[j])
  
  if sum >= A and sum <= B:
    ans += i
    
print(ans)

n, a, b = map(int, input().split())

res = 0
for i in range(1, n+1):
  tmp = sum([int(elem) for elem in list(str(i))])
  if a <= tmp and tmp <= b:
    res += i
print(res)

n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)

n, a, b = list(map(int, input().split()))
ans = 0

for i in range(1,n+1):
    mod = 0
    div = i
    while div > 0:
        mod += (div % 10)
        div //= 10
    if mod >= a and mod <= b:
        ans += i

print(ans)


#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

n, a, b = list(map(int, input().split()))

ans = 0
for i in range(1, n+1):
    tmp = 0
    for j in str(i):
        tmp += int(j)

    if tmp >= a and tmp <= b:
        ans += i
print(ans)


n,a,b = map(int,input().split())
c = 0
for i in range(1,n+1):
    s = 0
    d = i
    while d!=0:
        s+= d%10
        d//=10
    if a<=s<=b:
        c+=i
print(c)

x = list(map(int,input().split()))
n = int(x[0])
a = int(x[1])
b = int(x[2])

res = 0

for i in range(n+1):
  m = sum([int(r) for r in list(str(i))])
  if a <= m <= b:
    res += i

print(res)

N, A, B = list(map(int, input().split()))

total = 0
for i in range(1, N+1):
    subTotal = sum(list(map(int, str(i))))
    if subTotal >= A and subTotal <= B:
        total += i

print(total)


N,A,B = map(int,input().split())
ans_list = []

for i in range(0,N+1):
    if i < 10:
        if i >= A and i <=B:
            ans_list.append(i)
    else:
        temp = list(map(int,str(i)))
        temp=sum(temp)
        if temp >=A and temp<=B:
            ans_list.append(i)
            
print(sum(ans_list))

N, A, B = map(int,input().split())

answer = 0

for i in range(N + 1):
    numStrList = list(str(i))
    numIntList = [int(s) for s in numStrList] 

    if A <= sum(numIntList) <= B :
        answer += i

print(answer)

N,A,B=map(int,input().split())
count=0
for i in range(1,N+1):
    acc=0
    for j in range(len(str(i))):
        acc+=int(str(i)[j])
    if acc >= A and acc <= B: count+=i
print(count)

N,A,B = map(int, input().split())
 
ls = []
for n in range(1,N+1):
  sm = sum(int(s) for s in str(n))
  if A <= sm <= B:
    ls.append(int(n))
print(sum(ls))

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, A, B = LI()

    ans = 0
    for i in range(1, N + 1):
        if A <= sum([int(i) for i in str(i)]) <= B:
            ans += i

    print(ans)

def __starting_point():
    resolve()

__starting_point()

N, A, B = map(int, input().split())

ans = 0
for i in range(1, N+1):
  k = list(str(i))
  sum_i = 0
  for j in k:
    sum_i += int(j)
  if A <= sum_i <= B:
    ans += i
    
print(ans)

N, A, B = list(map(int, input().split()))

res = 0
for i in range(1, N+1):
    if(A <= sum(map(int, str(i))) <= B):
        res += i

print(res)


n, a, b = map(int, input().split())

ans = 0
for i in range(1, n+1):
    t = 0
    v = i
    while v > 0:
        t += v%10
        v//=10
    if a <= t <= b:
        ans += i
print(ans)

N, A, B = map(int, input().split())


def calc(N):
    sum = 0
    while N > 0:
        sum += N % 10
        N //= 10
    return sum


sum_num = 0
for i in range(1, N + 1):
    ans = calc(i)
    if A <= ans <= B:
        sum_num += i

print(sum_num)

N,A,B = map(int,input().split())

ans = 0
for i in range(N):
    n = i + 1
    arr = list(map(int,str(n)))
    summ = sum(arr)
    if summ >= A and summ <= B:
        ans += n
print(ans)

n, a, b = list(map(int, input().split()))
ans = 0

for i in range(1,n+1):
  sum = 0
  x = i
  while x > 0:
    sum += x%10
    x //= 10 
  if a<=sum and sum<=b:
    ans += i
  
print(ans)


N, A, B = list(map(int, input().split()))
ans = []
for i in range(1, N + 1):
    target = 0
    for j in range(len(str(i))):
        target += int(str(i)[j])
    if A <= target <= B:
        ans.append(i)

print((sum(ans)))


N,A,B=list(map(int,input().split()))
ans=0
for x in range(1,N+1):
    y=sum(int(c) for c in str(x))
    if A<=y and y<=B:
        ans+=x
print(ans)


N,A,B = list(map(int,input().split()))
s = 0
for i in range(1,N+1):
    tmp = sum(list(map(int,str(i))))
    if A<=tmp and tmp <= B:
        s += i

print(s)

N, A, B = list(map(int, input().split()))
res = 0

for i in range(1, N+1):
  num = sum(map(int, list(str(i))))
  if A <= num <= B:
    res += i
    
print(res)


lst = input().split()
N = int(lst[0])
A = int(lst[1])
B = int(lst[2])

def sum(n):
   result = 0
   s = str(n)
   for i in range(len(s)):
      result += int(s[i])
   return result

count = 0

for i in range(1, N+1):
   if A <= sum(i) <= B:
      count += i

print(count)

n_num, a_num, b_num = map(int, input().split())

def digit_sum(num):
    str_num = str(num)
    digit_num = 0
    for s in str_num:
        digit_num += int(s)
    return digit_num

cnt = 0
for n in range(1, n_num+1):
    if a_num <= digit_sum(n) <= b_num:

        cnt += n
        
print(cnt)

N,A,B = map(int,input().split())
ans_list = []

for i in range(0,N+1):

    temp = list(map(int,str(i)))
    temp=sum(temp)
    if temp >=A and temp<=B:
        ans_list.append(i)
            
print(sum(ans_list))

n, a, b = map(int, input().split())
ans = 0

for i in range(1, n+1):
  if a <= sum(list(map(int, str(i)))) <= b:
    ans += i
    
print(ans)

n, a, b = map(int, input().split())
sum = 0
sum_n = 0
for num in range(1, n+1):
  num2 = num
  sum_n = 0
  while num > 0:
    sum_n += num % 10
    num //= 10
  if sum_n >= a and sum_n <= b:
    sum += num2
print(sum)

N,A,B=map(int,input().split())
ans=[]
for i in range(1,N+1):
  j=i//10000+(i%10000)//1000+(i%1000)//100+(i%100)//10+(i%10)//1
  if A<=j<=B:
    ans.append(i)
  
print(sum(ans))

n, a, b = list(map(int, input().split()))

l = list(range(0))

for i in range(n+1):
    res = sum(list(map(int, str(i))))
    if res >= a and res <= b:
        l.append(i)

ans = sum(list(l))
print(ans)


def sum_of_digits(i: int) -> int:
    result = 0
    for _ in range(len(str(i))):
        i, mod = divmod(i, 10)
        result += mod

    return result


def answer(n: int, a: int, b: int) -> int:
    some_sums = 0
    for i in range(1, n + 1):
        if a <= sum_of_digits(i) <= b:
            some_sums += i

    return some_sums


def main():
    n, a, b = map(int, input().split())
    print(answer(n, a, b))


def __starting_point():
    main()
__starting_point()

N, A, B = map(int, input().split())

Sum = 0
for i in range(N):
  o = (i+1)//10000
  a = (i+1)%10000//1000
  b = (i+1)%1000//100
  c = (i+1)%100//10
  d = (i+1)%10
  e= o+a+b+c+d
  if e >= A and e <= B:
    Sum = Sum + (i+1)

print(Sum)

N, A, B = map(int, input().split())
ans = 0
for n in range(1, N+1):
  if A <= sum(list(map(int,list(str(n))))) <= B:
    ans += n
print(ans)

n, a, b = list(map(int, input().split()))
l = []
ans = 0
for i in range(n):
    l.append(str(i + 1))
for i in l:
    li = list(map(int, i))
    if a <= sum(li) <= b:
        ans += int(i)
print(ans)


N, A, B = map(int, input().split())

sum = 0
for i in range(N+1):
    x = 0
    for j in range(len(str(i))):
        x = x + int(str(i)[j])
    if A <= x <= B:
        sum = sum + i
print(sum)

n,a,b=map(int,input().split())
ans=0
for i in range(n+1):
    i=str(i)
    c=0
    for l in i:
        c+=int(l)
    if a<=c and c<=b:
        ans+=int(i)
print(ans)

n, a, b = list(map(int, input().split()))

ans = 0
for x in range(1, n + 1):
    c = sum(map(int, str(x)))
    if a <= c <= b:
        ans += x
print(ans)


n,a,b = map(int,input().split())

ans= 0

for i in range(n+1):
    if a <= sum(list(map(int, str(i)))) <= b:
        ans = ans + i

print(ans)

def findSumOfDigits(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n //= 10
    return int(sum)

N,a,b = map(int,input().split())
c = 0
total =0
for i in range(N+1):
    c = findSumOfDigits(i)
    if a <= c <= b:
        # print(i)
        # print(c)
        total += i
        # print(total)
print(total)

n, a, b = map(int, input().split())
print(sum(i for i in range(1, n+1) if a <= sum(map(int, str(i))) <=b))

#!/user/bin/env pypy3
import sys
from functools import reduce


def fast_input():
    return sys.stdin.readline()[:-1]


def digit_sum(num: int) -> int:
    str_num = str(num)
    return reduce(
        lambda acc, n: acc + int(n),
        list(str_num),
        0
    )


def solve(n: int, a: int, b: int) -> int:
    num_sum = 0
    for num in range(1, n + 1):
        if a <= digit_sum(num) <= b:
            num_sum += num
    return num_sum


def main():
    [n, a, b] = list(map(int, fast_input().split()))
    result = solve(n, a, b)
    print(result)


main()


N, A, B = map(int, input().split())

result = 0
for i in range(1, N+1):
    num = i//(10**4) + i//(10**3)%10 + i//(10**2)%10 + i//10%10 + i%10
    if A <= num <= B:
        result += i
print(result)

N, A, B =list(map(int,input().split()))

al = []
for i in range(1, N + 1):
    checkno = 0

    for j in range(len(str(i))):
        str_i = str(i)
        checkno += int(str_i[j])
    if A <= checkno and checkno <= B:
        al.append(i)

print((sum(al)))


n,a,b=map(int,input().split())
ans=0
for i in range(n+1):
  if a<=sum(list(map(int,list(str(i)))))<=b:
    ans += i
print(ans)

# import math
# import statistics
# import itertools
# a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(int(i))
N,A,B= list(map(int,input().split()))
# f = list(map(int,input().split()))
# g = [input().split for _ in range(a)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen
count=0
ans=[]
for i in range(1,N+1):
    cal=[]
    for k in str(i):
        cal.append(int(k))

    if A<=sum(cal)<=B:
        ans.append(i)
        
print((sum(ans)))
            


# coding: utf-8
# Your code here!

def sumDigit(x):
  sum_ = 0
  while x > 0:
    sum_ += x%10
    x //= 10
  return sum_

N,A,B=(int(x) for x in input().split())

ss = 0
for i in range(N):
  num = sumDigit(i+1)
  if num >= A and num <= B:
    ss += i+1

print(ss)

# -*- coding: utf-8 -*-

n, a, b = list(map(int, input().split()))
s = 0
ans = 0

def findSumOfDigits(num):
    s = 0
    while num > 0:
        s += int(num % 10)
        num  = int(num / 10)
    return s


for i in range(n + 1):
    s = findSumOfDigits(i)
    if a <= s <= b:
        ans += i
print(ans)


N,A,B = list(map(int,input().split()))

cnt = 0
for n in range(1,N+1):
    val = n % 10
    tmp = n
    while tmp // 10 > 0:
        
        tmp = tmp // 10
        val += tmp % 10
    if val >= A and val <= B:
        cnt += n
print(cnt)

n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
    x = list(str(i))
    x = list(map(int,x))
    x = sum(x)
    if a <= x <= b:
        ans += i
print(ans)

n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
    x = str(i)
    cnt = 0
    for j in range(len(x)):
        cnt += int(x[j])
    if a <= cnt and cnt <= b:
        ans += i
print(ans)

n, a, b = list(map(int, input().split()))
l = []
c = 0
k = 0

for i in range(n+1):
    k = i
    c = 0
    while (i > 0):
        c += i%10
        i //= 10
    if (a <= c <= b):
        l.append(k)

print((sum(l)))


N, A, B = map(int, input().split())
a = list()
for i in range(N + 1):
    if A <= sum(map(int, str(i))) <= B:
        a.append(i)
print(sum(a))

N, A, B = map(int, input().split())

res = []

for n in range(1, N+1):
    i = list(str(n))
    i = [int(n) for n in i]
    if A <= sum(i) <= B:
        res.append(int(n))

print(sum(res))

n, a, b = map(int, input().split())

ans = 0

for i in range(n + 1):
    l = list(map(int, str(i)))
    sum_l = sum(l)
    if sum_l >= a and sum_l <= b:
        ans += i

print(ans)

N,A,B = map(int, input().split())
sum1 = 0
for n in range(1, N+1):
  sum2 = 0
  for s in str(n):
    sum2 += int(s)
  if A <= sum2 <= B:
    sum1 += n
print(sum1)

getints = lambda: map(int, input().split())
n, a, b = getints()
ans = 0
for i in range(1, n+1):
    s = str(i)
    sum = 0
    for c in s:
        sum += int(c)
    if a <= sum <= b:
        ans += i
print(ans)

N, A, B = list(map(int,input().split()))
ans = 0
for i in range(N + 1):
  i = str(i)
  count = 0
  for j in i:
    count += int(j)
  if A <= count and B >= count:
    ans += int(i)
print(ans)


N,A,B = map(int,input().split())
con = 0
for i in range(1 , N + 1):
  a1 = i // 10000
  a2 = (i - a1 * 10000)// 1000
  a3 = (i - a1 * 10000 - a2 * 1000)// 100
  a4 = (i - a1 * 10000 - a2 * 1000 - a3 * 100) // 10
  a5 = i % 10
  if A <= a1 + a2+ a3 + a4 + a5 <= B:
    con += i
print(con)

N,A,B = map(int,input().split())
cnt = 0
sum = 0
i = 0
for i in range(N+1):
    j = 0
    tmpsum = 0
    l = list(str(i))
    for j in l:
        tmpsum += int(j)
    if tmpsum>=A and tmpsum <=B:
        sum += i
print(sum)

def solve(N, A, B):
    nums = []
    for n in range(1, N + 1):
        s = 0
        ns = str(n)
        for j in range(len(ns)):
            s += int(ns[j])
        if A <= s and s <= B:
            nums.append(n)
    print((sum(nums)))



def __starting_point():
    N, A, B = list(map(int, input().split()))
    solve(N, A, B)

__starting_point()

def calc_sum(num):
    ans = 0
    for i in range(len(str(num))):
        target = num % 10
        num //= 10
        ans += target
    return ans

def main():

    n, a, b = map(int, input().split())
    ans = 0
    for i in range(1, n + 1):
        num = calc_sum(i)
        if a <= num <= b:
            ans += i
    print(ans)

def __starting_point():
    main()
__starting_point()

N,A,B = list(map(int,input().split()))
ans = 0
for i in range(1,N+1):
  M = i//10000+i%10000//1000+i%1000//100+i%100//10+i%10
  if A <= M and M <= B:
    ans+=i
print(ans)


n, a, b = map(int,input().split())
count = 0
for i in range(1,n+1):
    num = i
    digit = 0
    while num > 0:
        digit += num % 10
        num = num // 10
    if a <= digit <= b:
        count += i
print(count)

N,A,B = map(int,input().split())

def aaa(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = n//10 
    return sum

sum = 0

for i in range(1,N+1):
    a = aaa(i)
    if A<= a <= B:
        sum += i
print(sum)

n,a,b = map(int, input().split())

ans = 0
for num in range(n+1):
    str_num = str(num)
    num_list = list(str_num)
    total = sum([int(i) for i in num_list])
    if total >= a and total <= b:
        ans+=num
print(ans)

N, A, B = list(map(int,input().split()))

def ten_sumfunc(n):
    ans = 0
    while(n>0):
        ans += n%10
        n = n//10
    return ans

total = 0
for i in range(N+1):
    sum1 = ten_sumfunc(i)
    if A <= sum1 and sum1 <= B:
        total += i
        
print(total)


#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

#        tmp = list([int(i) for i in (list(str(i)))])

def main():
    n,a,b = map(int,input().split())
    numbers=[]
    tmp=0

    for i in range(1,n+1):
        if i >=a and i <=b and i < 10:
            numbers.append(i)
        else:
            tmp_array=list(map(int,list(str(i))))
            if len(tmp_array) > 1:
                for j in tmp_array:
                    tmp+=j
                if tmp >=a and tmp <=b:
                    numbers.append(i)
                tmp=0
            else:
                continue
    print(sum(numbers))
            
def __starting_point():
    main()
__starting_point()

N, A, B = list(map(int,input().split()))

ans = 0

for i in range(1, N+1, 1):
  stri = str(i)
  sum = 0
  for j in range(len(str(i))):
    sum += int(stri[j])
  else:
    if sum >= A and sum <= B:
      ans += i
      
print(ans)



N,A,B = map(int, input().split())

ans = 0

for i in range(N+1):
    x = i%10
    if i >= 10:
        x += (i%100-i%10)/10
        if i >= 100:
            x += (i%1000-i%100)/100
            if i >= 1000:
                x += (i%10000-i%1000)/1000
                if i == 10000:
                    x=1
    if A <= x <= B:
        ans += i

print(ans)

def FindSumOfDigits(n):
  Sum = 0
  while n>0:
    Sum += n%10
    n //= 10
  return Sum

N, A, B = list(map(int, input().split()))
total = 0
for i in range(N):
  Sum = FindSumOfDigits(i+1)
  if A <= Sum and Sum <= B:
    total += i+1

print(total)


N,A,B=map(int,input().split())
x=y=z=a=b=sum=0
for i in range(1,N+1):
    x=i%10
    y=(i%100)//10
    z=(i%1000)//100
    a=(i%10000)//1000
    b=(i%100000)//10000

    if A<=x+y+z+a+b<=B:
        sum+=i
print(sum)

n,a,b = list(map(int,input().split()))
ans = 0
for i in range(1,n+1):
    temp = 0
    c = str(i)
    for j in range(len(c)):
        temp += int(c[j])
    if a <= temp and temp <= b:
        ans += i
print(ans)


N,A,B = map(int, input().split())
result = 0

def FindSomeOfDegit(x):
    count = 0
    while x > 0:
        count += x%10 
        x = x // 10
    return count

for i in range(N+1):
    count = FindSomeOfDegit(i)
    if A <= count <= B:
        result += i

print(result)