CodeEff/ECCO huggingface dataset:
# Original solution
N,A,B=list(map(int,input().split()))

def add(n,a,b):
  res=sum(map(int,list(str(n))))
  return n if res>=a and res<=b else 0

ans=0
for i in range(1,N+1):
  ans+=add(i,A,B)
print(ans)

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

def digit_sum(n):
  res = 0
  while n:
    res += n % 10
    n //= 10
  return res

answer = 0
for i in range(1, N + 1):
  if A <= digit_sum(i) <= B:
    answer += i
    
print(answer)
# Original solution
N, A, B = list(map(int, input().split()))
 
ans = 0
for n in range(1, N+1):
  s = sum(list(map(int, list(str(n)))))
  if A <= s and s <= B: ans += n
    
print(ans)

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

# 別解：10で割った余りを足していく
ans = 0
for n in range(1, N+1):
  s = 0
  m = n
  while m > 0:
    s += m % 10
    m = m // 10
  if A <= s and s <= B: ans += n
    
print(ans)
# Original solution
inp = list(map(int,input().split()))
N = inp[0]
A = inp[1]
B = inp[2]
l=list()
for i in range(N+1):
    n0 = i % 10
    n1 = (i % 100 - n0) // 10
    n2 = (i % 1000 - n0 - n1*10) // 100
    n3 = (i % 10000 - n0 - n1*10 - n2*100) // 1000
    n4 = (i % 100000 - n0 - n1*10 - n2*100 - n3*1000) // 10000
    if A <= n0+n1+n2+n3+n4 <= B:
        l.append(i)
print((sum(l)))

# Optimized solution
def FindSumOfDigits(n):
    s = 0
    while n > 0:
        s = s + n % 10
        n = n // 10       
    return s

inp = list(map(int,input().split()))
N = inp[0]
A = inp[1]
B = inp[2]
l=list()

sd = 0
for i in range(N+1):
    x = FindSumOfDigits(i)
    if A <= x <= B:
        sd = sd + i
    
print(sd)
# Original solution
(lambda NAB: print(sum([int(i) for i in range(1, NAB[0] + 1) if NAB[1] <= sum(map(int, list(str(i)))) <= NAB[2]])))([int(i) for i in input().split()])


# Optimized solution
(lambda N,A,B:print(sum([int(i) for i in range(1,N+1) if A<=sum(map(int,list(str(i))))<= B])))(**dict(zip(["N","A","B"],[int(i) for i in input().split()])))
# Original solution
#ANS-3
input_N,A,B = input().split()
A = int(A)
B = int(B)

count = 0
for i in range(int(input_N)+1):
    sum_all = 0
    i_str = str(i)
    for j in range(len(i_str)):
        sum_all += int(i_str[j])
    if A<=sum_all:
        if sum_all<=B:
            count += i
            
print(count)

# Optimized solution
#ANS-4
in_N,A,B = list(map(int,input().split()))

count = 0
for i in range(in_N +1):
    sum_all = 0
    i_str = str(i)
    for j in range(len(i_str)):
        sum_all += int(i_str[j])
    if A<=sum_all:
        if sum_all<=B:
            count += i
            
print(count)
# Original solution
def main():
    N, A, B = list(map(int, input().split()))
    ans = 0
    for i in range(1, N + 1):
        t = sum(list(map(int, list(str(i)))))
        if A <= t <= B:
            ans += i
    print(ans)


main()


# Optimized solution
def main():
    N, A, B = list(map(int, input().split()))
    ans = 0
    for i in range(1, N + 1):
        if A <= sum(map(int, str(i))) <= B:
            ans += i
    print(ans)


main()
# Original solution
n, a, b = list(map(int, input().split()))

l = []
ans = 0

for i in range(1, n + 1):
    if len(str(i)) == 1 and a <= i <= b:
        l.append(i)
    elif len(str(i)) != 1:
        ans = sum(int(j) for j in str(i))
        if a <= ans <= b:
            l.append(i)
print((sum(l)))

# Optimized solution
res = 0

N, A, B = list(map(int, input().split()))
for i in range(1, N + 1):
    if A <= sum(int(j) for j in str(i)) <= B:
        res += i

print(res)
# Original solution
res = 0

N, A, B = list(map(int, input().split()))
for i in range(1, N + 1):
    if A <= sum(int(j) for j in str(i)) <= B:
        res += i

print(res)

# Optimized solution
N, A, B = list(map(int, input().split()))
cnt = 0
for i in range(1, N + 1):
    if A <= sum(int(j) for j in str(i)) <= B:
        cnt += i
print(cnt)
# Original solution
n, a, b = list(map(int, input().split()))

ans = 0

for i in range(1, n + 1):
    num = i
    total = 0
    while num != 0:
        total += num % 10
        num //= 10

    if a <= total <= b:
        ans += i

print(ans)


# Optimized solution
def sum_digits(num):
    total = 0
    while num != 0:
        total += num % 10
        num //= 10
    return total

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

ans = 0

for i in range(1, n + 1):
    num = i
    total = sum_digits(num)

    if a <= total <= b:
        ans += i

print(ans)
# Original solution
n, a, b = list(map(int, input().split()))

count = 0
for i in range(1, n+1):
    check = 0
    for x in list(str(i)):
        check += int(x)

    if a <= check <= b:
        count += i

print(count)


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

ans = 0
for num in range(1, n+1):
    str_num = str(num)

    sum = 0
    for s in str_num:
        sum += int(s)

    if a <= sum <= b:
        ans += num

print(ans)
# Original solution
n, a, b = list(map(int, input().split()))

ans = 0
for i in range(1, n+1):
    si = list(str(i))
    s = sum(map(int, si))
    if a <= s <= b:
        ans += i
print(ans)


# Optimized solution
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
    s = 0
    i_ = i
    while i_ > 0:
        s += i_%10
        i_ //= 10
    if a <= s <= b:
        ans += i
print(ans)
# Original solution
n, a, b = list(map(int, input().split()))
nSum = 0
for i in range(n):
    if a <= sum([int(d) for d in list(str(i + 1))]) <= b:
        nSum += i + 1
print(nSum)


# Optimized solution
n, a, b = list(map(int, input().split()))
print((sum(i + 1 for i in range(0, n) if a <= sum([int(d) for d in list(str(i + 1))]) <= b)))
# Original solution
n, a, b = list(map(int, input().split()))
total = 0
for i in range(1, n+1):
  li = list(str(i))
  m = 0
  for j in li:
    m += int(j)
  if a <= m <= b:
    total += i
print(total)

# Optimized solution
n, a, b = list(map(int, input().split()))
total = 0
for i in range(1, n+1):
  m = 0
  ni = i
  while ni > 0:
    m += ni % 10
    ni = ni // 10
  if a <= m <= b:
    total += i
print(total)
# Original solution
N, A, B = list(map(int, input().split()))
count = 0
for i in range(1, N+1):
    res = 0
    for j in range(len(str(i))):
        res += int(str(i)[j])
    if A <= res <= B:
        count += i
    
    
print(count)

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

res = 0
for i in range(1, N+1):
    tmp = list(str(i))
    s = 0
    for j in range(len(tmp)):
        s += int(tmp[j])
    if A <= s <= B:
        res += i
        
print(res)
# Original solution
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(0, n + 1):
    if a <= sum([int(j) for j in str(i)]) <= b:
        ans += i
print(ans)

# Optimized solution
n, a, b = list(map(int, input().split()))
ans = 0


def sum_(m):
    res = 0
    while m > 0:
        res += m % 10
        m //= 10
    return res


for i in range(0, n + 1):
    # if a <= sum([int(j) for j in str(i)]) <= b:
    if a <= sum_(i) <= b:
            ans += i
print(ans)
# Original solution
N, A, B = list(map(int, input().split()))
num = 0
for i in range(1, N + 1):
    if A <= sum(int(n) for n in str(i)) <= B:
        num += i
print(num)


# Optimized solution
N, A, B = list(map(int, input().split()))
print((sum(i for i in range(1, N+1) if A <= sum(map(int, str(i))) <= B)))
# Original solution
N, A, B = list(map(int, input().split()))
print((sum(i for i in range(1, N+1) if A <= sum(map(int, str(i))) <= B)))


# Optimized solution
N, A, B = [int(i) for i in input().split()]
print((sum(i for i in range(1, N+1) if A <= sum(map(int, str(i))) <= B)))
# Original solution
#083 B
N,A,B =list(map(int,input().split()))
ans = 0
for i in range(N+1):
    tmp=0

    for j in range(len(str(i))):
        tmp+=int(str(i)[j])
    if A<=tmp<=B:
        ans +=i
print(ans)

# Optimized solution
# B - Some Sums
N,A,B= list(map(int,input().split()))
cnt = 0
for n in range(1,N+1):
    tmp = sum([int(i) for i in str(n)])
    if A<=tmp and tmp <= B:
        cnt+=n
print(cnt)
# Original solution
N, A, B = list(map(int, input().split()))

ans = 0
for i in range(N+1):
    s = str(i)
    jdg = 0
    for k in range(len(s)):
        jdg += int(s[k])
    if A <= jdg and jdg <=B:
        ans += i
print(ans)

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

ans = 0
for i in range(N+1):
    q = i
    jdg = 0
    for k in range(5):
        jdg += q%10
        q //= 10
    if A <= jdg and jdg <=B:
        ans += i
print(ans)
# Original solution
# スペース区切りの整数の入力
N, a, b= list(map(int, input().split()))
summation = 0

for i in range(N+1):
    num = i
    total = 0
    while num != 0:
        q, mod = divmod(num, 10)
        total += mod
        num = q
    
    if total >= a and total <= b:
        summation += i
    
print(summation)

# Optimized solution
N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N+1):
    if A <= sum(map(int, str(i))) <= B:
        ans += i
print(ans)
# Original solution
N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N+1):
    si = list(str(i))
    isum = sum(int(k) for k in si)
    if A <= isum <= B:
        ans += i
print(ans)

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

def solve(n):
    if n == 0:
        return 0
    else:
        temp = n % 10
        return temp + solve(n // 10)

ans = 0
for i in range(1, N+1):
    if A <= solve(i) <= B:
        ans += i
print(ans)
# Original solution
N, A, B = list(map(int, input().split()))
ans = 0

for i in range(0, N+1, 10):
    for j in range(10):
        temp = str(i + j)
        if (int(temp) > N):
            break

        sum = 0
        for k in range(len(temp)):
            sum += int(temp[k])
        if (A <= sum) and (sum <= B):
            ans += int(temp)
        elif (B < sum):
            break

print(ans)


# Optimized solution
N, A, B =list(map(int,input().split()))
sum = 0
for i in range(1,N+1,1):
  i = str(i)
  num = 0
  for j in range(len(i)):
    num += int(i[j])
  if num >= A and num<=B:
    sum += int(i)
    
print(sum)
# Original solution
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
    if a <= sum(list(map(int,str(i)))) <= b:
        ans += i
print(ans)

# Optimized solution
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
    tmp = 0
    q = i
    while q > 0:
        tmp += q % 10
        q //= 10
    if a <= tmp <= b:
        ans += i
print(ans)
# Original solution
N, A, B = list(map(int, input().split()))

ans = 0
for i in range(1, N + 1):
    s = 0
    i = str(i)
    for n in i:
        s += int(n)
    if A <= s <= B:
        ans += int(i)
print(ans)

# Optimized solution
N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
    s = sum(map(int, list(str(i))))
    if A <= s <= B:
        ans += i
print(ans)
# Original solution
def sm(x):
    xls = list(str(x))
    a = 0
    for i in range(len(xls)):
        a += int(xls[i])
    return a

N, A, B = list(map(int,input().split()))
ans = 0
for i in range(1, N+1):
    if A <= sm(i) <= B:
        ans += i
print(ans)


# Optimized solution
def sm(x):
    a = 0
    a += (x%10)
    a += (x//10)%10
    a += ((x//10)//10)%10
    a += (((x//10)//10)//10)%10
    a += ((((x//10)//10)//10)//10)%10
    return a

N, A, B = list(map(int,input().split()))
ans = 0
for i in range(1, N+1):
    if A <= sm(i) <= B:
        ans += i
print(ans)
# Original solution
import sys
input = sys.stdin.readline

INF = float('inf')


def number2digits(number):
    return list(map(int, str(number)))

def main():
    N, A, B = list(map(int, input().split()))
    ans = 0
    for number in range(1, N+1):
        num_digits_list = number2digits(number)
        total = 0
        for i in num_digits_list:
            total += int(i)
        if A <= total <= B:
            ans += number

    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
import sys
input = sys.stdin.readline

INF = float('inf')


def number2digits(number):
    return list(map(int, str(number)))


def sum_of_digits(number):
    sum = 0
    while number > 0:
        sum += number % 10
        number //= 10
    return sum


def main():
    N, A, B = list(map(int, input().split()))
    ans = 0
    for number in range(1, N+1):
        total = sum_of_digits(number)
        if A <= total <= B:
            ans += number

    print(ans)


if __name__ == '__main__':
    main()
# Original solution
# -*- coding: utf-8 -*-

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

answer = 0

for i in range(n+1):
    nc = list(str(i))
    nc = list(map(int,nc))
    ncsum = sum(nc)
    nc = list(map(str,nc))
    nc = int("".join(nc))
    if a <= ncsum and b >= ncsum:
        answer += nc

print(answer)


# Optimized solution
# -*- coding: utf-8 -*-

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

def digit_list(num):
    num = str(num)
    num = list(num)
    num = list(map(int,num))
    return num

cnt = 0

for i in range(1,n+1):
    temp = sum(digit_list(i))
    if a <= temp <= b:
        cnt += i

print(cnt)
# Original solution
n,a,b = list(map(int,input().split()))
ans = 0;
for i in range(1,n+1):
    sum = 0;
    x = i;
    while x:
        sum += int(x%10);
        x/=10;
    if a <= sum <= b:
        ans+=i;
print(("%d" % (ans) ));

# Optimized solution
# n,a,b = map(int,input().split())
# ans = 0;
# for i in range(1,n+1):
#     sum = 0;
#     x = i;
#     while x:
#         sum += int(x%10);
#         x/=10;
#     if a <= sum <= b:
#         ans+=i;
# print("%d" % (ans) );

n,a,b = list(map(int,input().split()))
ans = 0;
for i in range(n+1):
    str_i = str(i)
    sum = 0;
    for x in str_i:
        sum += int(x)
    if a <= sum <= b:
        ans+=i;
print(ans)
# Original solution
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    a,b,c,d = LI()
    if a+b > c+d:
        print("Left")
    elif a+b == c+d:
        print("Balanced")
    else:
        print("Right")
    return

#B
def B():
    def digit_sum(n):
        res = 0
        m = n
        while m:
            res += m%10
            m//=10
        return res
    n,a,b = LI()
    ans = 0
    for i in range(1,n+1):
        if a <= digit_sum(i) <= b:
            ans += i
    print(ans)
    return

#C
def C():
    x,y = LI()
    ans = 1
    for i in range(10000000000000):
        x *= 2
        if x > y:break
        ans += 1
    print(ans)

#D
def D():
    s = S()
    n = len(s)
    ans = n
    for i in range(n-1):
        if s[i] != s[i+1]:
            ans = min(ans,max(i+1,n-i-1))
    print(ans)

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()


# Optimized solution
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,a,b = LI()
    ans = 0
    for i in range(1,n+1):
        if a <= sum(map(int, str(i))) <= b:
            ans += i
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()
# Original solution
# -*- coding: utf-8 -*-

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

ans = 0
# 1～Nのループ
for i in range(1, N+1):

    sum1 = 0
    num = i
    # 各桁の値を合計していく
    for j in range(len(str(i))):
        sum1 += num % 10
        num = int(num / 10)
    # 条件に合っていれば答えに足す
    if sum1 >= A and sum1 <= B:
        ans += i

print(ans)

# Optimized solution
# -*- coding: utf-8 -*-

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

ans = 0
# 1～Nのループ
for i in range(1, N+1):

    sum1 = 0
    num = i
    # 各桁の値を合計していく
    while num > 0:
        sum1 += num % 10
        num //= 10
    # 条件に合っていれば答えに足す
    if sum1 >= A and sum1 <= B:
        ans += i

print(ans)
# Original solution
n,a,b=list(map(int,input().split()))
s=0
for i in range(n+1):
    c=0
    d=str(i)
    for j in range(len(d)):
        c+=int(d[j])
    if a<=c<=b:
        s+=i
print(s)

# Optimized solution
n,a,b=list(map(int,input().split()))
print((sum(i for i in range(n+1) if(a<=sum(map(int,str(i)))<=b))))
# Original solution
n,a,b=list(map(int,input().split()))
ans=0
for i in range(n+1):
    if a<=sum(map(int,str(i)))<=b:ans+=i
print(ans)

# Optimized solution
n,a,b=list(map(int,input().split()))
print((sum(i for i in range(n+1) if a<=sum(map(int,str(i)))<=b)))
# Original solution
def main():
  n, a, b = list(map(int, input().split()))
  cnt = 0
  for i in range(1, n+1):
    if a <= sum(map(int, list(str(i)))) <= b:
      cnt += i
  print(cnt)
  
if __name__ == '__main__':
  main()

# Optimized solution
def main():
  n, a, b = list(map(int, input().split()))
  cnt = 0
  for i in range(1, n+1):
    if a <= i//10000 + (i//1000)%10 + (i//100)%10 + (i//10)%10 + i%10<= b:
      cnt += i
  print(cnt)
  
if __name__ == '__main__':
  main()
# Original solution
N, A, B = list(map(int, input().split()))
def count(X):
    sum = 0
    for n in str(X):
        sum += int(n)
    return sum

print((sum(x for x in range(1, N+1) if A <= count(x) <= B)))

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

print((sum(x for x in range(1, N+1) if A <= sum(map(int, str(x))) <= B)))
# Original solution
n,a,b = list(map(int,input().split()))
f = []
s = []
for i in range(a,n+1):
    c = str(i)
    for j in range(len(c)):
        s.append(int(c[j]))
    if sum(s[:5])>=a and sum(s[:5])<=b:
        f.append(i)
    s=[]
print((sum(f)))

# Optimized solution
n,a,b = list(map(int,input().split()))
s = 0
for i in range(1,n+1):
    d = sum(list(map(int,str(i))))
    if d>=a and d<=b:
        s+=i
print(s)
# Original solution
N, A, B = list(map(int,input().split()))

count = 0

for i in range(1, N + 1):
    dict_sum = sum(map(int, str(i)))
    if A <= dict_sum <= B:
        count = count + i

print(count)

# Optimized solution
N, A, B = list(map(int, input().split()))
print((sum(i for i in range(1, N+1) if A <= sum(map(int, str(i))) <= B)))
# Original solution
line = list(map(int,input().split()))
n = line[0]
a = line[1]
b = line[2]

nums = []
for num in range(n+1):
  sowa = 0
  count = len(str(num))
  for i in range(count):
    num = str(num)
    sowa += int(num[i])
  if a <= sowa and sowa <= b:
    nums.append(num)
answer = 0
for j in nums:
  answer += int(j)
print(answer)

# Optimized solution
n,a,b = list(map(int,input().split()))
nums = []
for i in range(1,n+1):
  summ = sum(list(map(int,str(i))))
  if a <= summ <= b:
    nums.append(i)
print((sum(nums)))
# Original solution
N, A, B = list(map(int, input().split()))
total = 0
for i in range(1, N + 1, 1):
    i_sum = 0
    for j in range(len(str(i))):
        i_sum += int(str(i)[j])
    # print("i_sum", i_sum)
    if A <= i_sum and i_sum <= B:
        total += i

print(total)

# Optimized solution
N, A, B = list(map(int, input().split()))
total = 0

# 各桁の和を計算する関数
def sumOfDigits(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = n // 10
    return sum

for i in range(1, N + 1, 1):
    j = sumOfDigits(i)
    if A <= j and j <= B:
        total += i

print(total)
# Original solution
n, lo, hi = list(map(int, input().rstrip("\n").split()))
print((sum([i if lo <= sum(map(int, str(i))) <= hi else 0 for i in range(n + 1)])))


# Optimized solution
[print(sum(num for num in range(int(n) + 1) if a <= sum(map(int, str(num))) <= b)) for n, a, b in [map(int, input().split())]]
# Original solution
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
    if a <= sum(map(int, str(i))) <= b:
        ans += i
print(ans)

# Optimized solution
n,a,b=list(map(int,input().split()))
print((sum(i for i in range(n+1) if a<=sum(map(int,str(i)))<=b)))
# Original solution
n, a, b= list(map(int, input().split()))
ALlsum = 0

for i in range(1, n+1):
    sum = 0
    i = str(i)
    i_len = len(i)
    for j in range(i_len):
        sum += int(i[j])
    if a<=sum and sum<=b :
        ALlsum += int(i)


print(ALlsum)

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

Ssum = 0
for i in range(1, n+1):
    tmp = i
    sum = 0
    while i>0 :
        sum += i%10
        i //= 10
    if a<=sum and sum<=b:
        Ssum += tmp

print(Ssum)
# Original solution
N,A,B = list(map(int, input().split()))

def Nsum(N):
    Ns = str(N)
    return sum(list(map(int,Ns)))

count = 0
for i in range(1,N+1):
    if Nsum(i)>=A and Nsum(i)<=B:
        count += i

print(count)

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

print((sum(list(n for n in range(N+1) if A<=sum(list(int(a) for a in str(n)))<=B))))
# Original solution
N, A, B = list(map(int, input().split()))
ans = 0

for i in range(1,N+1):
  i_str = str(i)
  i_len = len(i_str)
  sum = 0
  for j in range(i_len):
    sum += int(i_str[j])
  if sum >= A and sum <= B:
    ans += i
    
print(ans)

# Optimized solution
#定石の商と剰余でやってみた

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

for i in range(1,N+1):
  n = i
  sum = 0
  while n > 0:
    sum += n % 10
    n = n // 10
  if sum >= A and sum <= B:
    ans += i
    
print(ans)
# Original solution
N, A, B = list(map(int, input().split()))
sum = 0
ans = 0
for i in range (N+1):
  for j in range (len(str(i))):
    sum += int(str(i)[j])
  if A <= sum  and sum <= B:
    ans += i
  sum = 0
print(ans)
  


# Optimized solution
def keta(n):
  sum = 0
  while n>0:
    sum += n%10 
    n = n//10 
  return(sum)
def mium():
  N, A, B = list(map(int, input().split()))
  ans = 0
  for i in range (N):
    a = keta(i+1)
    if A <= a and a <= B:
      ans += i+1
  print(ans)
if __name__ == "__main__":
  mium()
# Original solution
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)


# Optimized solution
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)
# Original solution
def calc_sum_digits(n):
    return sum(int(x) for x in str(n))

N, A, B = list(map(int, input().split()))
print((sum(n if A <= calc_sum_digits(n) <= B else 0 for n in range(1, N+1))))

# Optimized solution
def calc_sum_digits(n):
    sumdigit = 0
    while n > 0:
        sumdigit += n % 10
        n //= 10
    return sumdigit

N, A, B = list(map(int, input().split()))
result = 0
for n in range(1, N+1):
    if A <= calc_sum_digits(n) <= B:
        result += n
print(result)
# Original solution
n, a, b = list(map(int, input().split()))

total = 0
for i in range(1, n+1):
    s = str(i)
    tmp = 0
    for j in s:
        tmp += int(j)
    if a <= tmp <= b:
        total += i
print(total)

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

ans = 0
for i in range(1, n+1):
    tmp = 0
    for j in str(i):
        tmp += int(j)
    if a <= tmp <= b:
        ans += i

print(ans)
# Original solution
n,a,b=list(map(int,input().split()))
ans=0
for i in range(n+1):
    if a<=sum(list(map(int,list(str(i)))))<=b:
        ans+=i
print(ans)

# Optimized solution
n,a,b=list(map(int,input().split()))
ans=0
for i in range(1,n+1):
    if a<=sum(list(map(int,str(i))))<=b:
        ans+=i
print(ans)