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

ttl,a,b=0,0,0

L=[]

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

  L=list(map(str,str(i)))

  for j in L:

    a=a+int(j)

  if B>=a>=A:

    ttl=ttl+i

  a=0

  L=[]

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

sum,a,b=0,0,0

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

  b=i

  if b<10:

    a=b

  else:

    while b>=10:

      a=a+b%10

      b=b//10

      if b<10:

        a=a+b

  if B>=a>=A:

    sum=sum+i

  a=0

print(sum)
N, A, B = list(map(int, input().split()))
ttl, a, b = 0, 0, 0
L = []
for i in range(1, N + 1):
    L = list(map(str, str(i)))
    for j in L:
        a = a + int(j)
    if B >= a >= A:
        ttl = ttl + i
    a = 0
    L = []
print(ttl)

N, A, B = list(map(int, input().split()))
sum, a, b = 0, 0, 0
for i in range(1, N + 1):
    b = i
    if b < 10:
        a = b
    else:
        while b >= 10:
            a = a + b % 10
            b = b // 10
            if b < 10:
                a = a + b
    if B >= a >= A:
        sum = sum + i
    a = 0
print(sum)

-ttl, a, b = 0, 0, 0 -L = [] +sum, a, b = 0, 0, 0 -    L = list(map(str, str(i))) -    for j in L: -        a = a + int(j) +    b = i +    if b < 10: +        a = b +    else: +        while b >= 10: +            a = a + b % 10 +            b = b // 10 +            if b < 10: +                a = a + b -        ttl = ttl + i +        sum = sum + i -    L = [] -print(ttl) +print(sum)