x, min, max = input().rstrip().split()

ans = 0

i = int(x)

while i > 0:

    num = sum(map(int, str(i)))

    if int(min) <= num <=int(max):

        ans += i

    i = i - 1

print(ans)
x, min, max = input().rstrip().split()

ans = 0

for i in range(int(x) + 1):

    if int(min) <= sum(map(int, str(i))) <=int(max):

        ans += i

print(ans)

x, min, max = input().rstrip().split()
ans = 0
i = int(x)
while i > 0:
    num = sum(map(int, str(i)))
    if int(min) <= num <= int(max):
        ans += i
    i = i - 1
print(ans)

x, min, max = input().rstrip().split()
ans = 0
for i in range(int(x) + 1):
    if int(min) <= sum(map(int, str(i))) <= int(max):
        ans += i
print(ans)

-i = int(x) -while i > 0: -    num = sum(map(int, str(i))) -    if int(min) <= num <= int(max): +for i in range(int(x) + 1): +    if int(min) <= sum(map(int, str(i))) <= int(max): -    i = i - 1