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

sum = 0

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

  isum = 0

  m = i

  for j in range(5):

    isum += m%10

    m //= 10

  if a <= isum <= b:

    sum += i

print(sum)

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

sum = 0

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

  isum = 0

  m = i

  while m != 0:

    isum += m%10

    m //= 10

  if a <= isum <= b:

    sum += i

print(sum)

n, a, b = list(map(int, input().split()))
sum = 0
for i in range(1, n + 1):
    isum = 0
    m = i
    for j in range(5):
        isum += m % 10
        m //= 10
    if a <= isum <= b:
        sum += i
print(sum)

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

-    for j in range(5): +    while m != 0: