length,mi,ma = list(map(int,input().split()))

summ = 0

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

  digits = len(str(i))

  digits_summary = 0

  

  for j in range(digits):

    digits_summary += int(str(i)[j])

  

  if mi<=digits_summary and digits_summary<=ma:

    summ += i

  else:

    pass

print(summ)
length,mi,ma = list(map(int,input().split()))

summ = 0

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

  s = str(i)

  arr = list(map(int,s))

  su = sum(arr)

  if(su <= ma and su >= mi):

    summ += i

print(summ)

  
length, mi, ma = list(map(int, input().split()))
summ = 0
for i in range(1, length + 1):
    digits = len(str(i))
    digits_summary = 0
    for j in range(digits):
        digits_summary += int(str(i)[j])
    if mi <= digits_summary and digits_summary <= ma:
        summ += i
    else:
        pass
print(summ)

length, mi, ma = list(map(int, input().split()))
summ = 0
for i in range(1, length + 1):
    s = str(i)
    arr = list(map(int, s))
    su = sum(arr)
    if su <= ma and su >= mi:
        summ += i
print(summ)

-    digits = len(str(i)) -    digits_summary = 0 -    for j in range(digits): -        digits_summary += int(str(i)[j]) -    if mi <= digits_summary and digits_summary <= ma: +    s = str(i) +    arr = list(map(int, s)) +    su = sum(arr) +    if su <= ma and su >= mi: -    else: -        pass