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



result_sum = 0

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

    keta_sum = 0

    for j in range(len(str(i))):

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



    if a <= keta_sum and b >= keta_sum:

        result_sum += i

    keta_sum = 0



print(result_sum)



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

count = 0



for i in range(1,n+1): #startnumber, endnumber

  s = str(i)

  numSum = 0

  for si in range(len(s)):

    numSum += int(s[si]) 

  

  if numSum >= b and numSum <= c:

    count += i



print(count)

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

n, b, c = list(map(int, input().split()))
count = 0
for i in range(1, n + 1):  # startnumber, endnumber
    s = str(i)
    numSum = 0
    for si in range(len(s)):
        numSum += int(s[si])
    if numSum >= b and numSum <= c:
        count += i
print(count)

-n, a, b = list(map(int, input().split())) -result_sum = 0 -for i in range(1, n + 1): -    keta_sum = 0 -    for j in range(len(str(i))): -        keta_sum += int(str(i)[j]) -    if a <= keta_sum and b >= keta_sum: -        result_sum += i -    keta_sum = 0 -print(result_sum) +n, b, c = list(map(int, input().split())) +count = 0 +for i in range(1, n + 1):  # startnumber, endnumber +    s = str(i) +    numSum = 0 +    for si in range(len(s)): +        numSum += int(s[si]) +    if numSum >= b and numSum <= c: +        count += i +print(count)