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

Total = 0

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

    total = 0

    str_i = str(i)

    len_i = len(str_i)

    for l in range(len_i):

        total += int(str_i[l])

    if A <= total <= B:

        Total += i

print(Total)

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

All = 0



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

    total = 0

    j = i

    while j != 0:

        total += j % 10

        j = j // 10

    if A <= total <= B:

        All += i



print(All)
N, A, B = list(map(int, input().split()))
Total = 0
for i in range(1, N + 1):
    total = 0
    str_i = str(i)
    len_i = len(str_i)
    for l in range(len_i):
        total += int(str_i[l])
    if A <= total <= B:
        Total += i
print(Total)

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

-Total = 0 +All = 0 -    str_i = str(i) -    len_i = len(str_i) -    for l in range(len_i): -        total += int(str_i[l]) +    j = i +    while j != 0: +        total += j % 10 +        j = j // 10 -        Total += i -print(Total) +        All += i +print(All)