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

# まずN <= 10**4だからO(N)で間に合う
ans = 0
for i in range(1, N+1):
    num = 0
    if i < 10:  # 1桁
        num = i
    elif i < 10**2:
        ii = i
        for j in [10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    elif i < 10**3:
        ii = i
        for j in [10**2, 10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    elif i < 10**4:
        ii = i
        for j in [10**3, 10**2, 10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    else:  # i == 10**4
        ii = i
        for j in [10**4, 10**3, 10**2, 10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    
    if A <= num and num <= B:
        ans += i

print(ans)

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

# まずN <= 10**4だからO(N)で間に合う
ans = 0
for i in range(1, N+1):
    ii = i
    num = 0
    while ii != 0:
        num += ii % 10  # iiの1の位を加算 (ex. ii = 234 -> num = 4)
        ii = ii // 10  # 一桁右にずらす (ex. 234 -> 23)

    if A <= num and num <= B:
        ans += i
print(ans)
# Original solution
N, A, B = list(map(int, input().split()))
ans = []

def degitsum(x):
	string = str(x)
	array = list(map(int, string))
	return sum(array)

for i in range(N+1):
	if A <= degitsum(i) and degitsum(i) <= B:
		ans.append(i)
	else:
		continue
		
print((sum(ans)))

# Optimized solution
def degitsum(n):
    ans = 0
    while n/10 != 0:
        ans += n%10
        n = int(n/10)
    return ans

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

ans = 0
for i in range(1, n+1):
    if a <= degitsum(i) <= b:
        ans += i
    else:
        continue
        
print(ans)
# Original solution
def degitsum(n):
    ans = 0
    while n/10 != 0:
        ans += n%10
        n = int(n/10)
    return ans

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

ans = 0
for i in range(1, n+1):
    if a <= degitsum(i) <= b:
        ans += i
    else:
        continue
        
print(ans)

# Optimized solution
# B
# 2020/03/06 14:34-
n, a, b = list(map(int, input().split()))

def SumDegit(x):
    ans = 0
    while x > 0:
        ans += x%10
        x = x//10
    return ans

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

res = 0

for n in range(N + 1):
    sum_digit = 0
    i = n
    while i:
        i, reminder = divmod(i, 10)
        sum_digit += reminder
    if A <= sum_digit <= B:
        res += n
print(res)


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

ans = 0
for i in range(1, N + 1):
    k = i
    p = 0
    while k > 0:
        p += k % 10
        k //= 10
    if A <= p <= B:
        ans += i

print(ans)
# Original solution
n,a,b=list(map(int,input().split()))
listint=[i for i in range(1,n+1)]
liststr=[str(listint[i]) for i in range(n)]
anssum=[[] for i in range(n)]
def calculate_sum(listint,liststr,k):
  sumnumber=liststr[k-1]
  sumlist=list(sumnumber)
  sumlistint=[int(sumlist[i]) for i in range(len(sumlist))]
  sum=0
  for i in range(len(sumlistint)):
    sum=sum+sumlistint[i]
  return(sum)
for k in range(0,n):
  anssum[k]=[listint[k],calculate_sum(listint,liststr,k+1)]
answer=0
for i in range(0,n):
  if a<=anssum[i][1]<=b:
    answer=answer+anssum[i][0]
print(answer)
    
  

# Optimized solution
n,a,b=list(map(int,input().split()))
answer=0
for i in range(1,n+1):
   if a<=sum(map(int,str(i)))<=b:
      answer=answer+i
print(answer)
# Original solution
Lis = list(map(int,input().split()))
ans = 0
for k in range(Lis[0]+1):
    if k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 <= Lis[2] and k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 >= Lis[1]:
        ans += k
if Lis[0] == 10000 and Lis[1]<2:
           print((ans+10000))
else:
           print(ans)
        

# Optimized solution
a = list(map(int,input().split()))
N = a[0]
A = a[1]
B = a[2]
Lis = []
for i in range(1,N+1):
    k = i%10 + i//10%10 + i//10//10%10 + i//10//10//10%10 + i//10//10//10//10%10
    if k <= B and k >= A:
        Lis.append(i)
print((sum(Lis)))
# Original solution
n,a,b = list(map(int,input().split()))
ans = 0
i = 1
while i <= n:
    x = 0
    li = list(str(i))
    for p in li:
        x += int(p)
    if a <= x <= b:
        ans += i
        i += 1
    else:
        i += 1
print(ans)

# Optimized solution
n,a,b = list(map(int,input().split()))
ans = 0
i = 1
for i in range(1,n+1):
    x = 0
    num = str(i)
    for p in num:
        x += int(p)
    if a <= x <= b:
        ans += i
        i += 1
print(ans)
# Original 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)))

# Optimized solution
N,A,B = list(map(int,input().split()))
memo =[0]*37

def S(n):
  if n<10:
    return n
  else:
    return n%10+S(n//10)
for i in range(N+1):
  memo[S(i)] += i
print((sum(memo[A:B+1])))
# Original solution
[N, A, B] = input().split()
SUM = 0
for i in range(1, int(N)+1):
  list_i = list(str(i))
  sum_i = sum(list(map(int, list_i)))
  if int(A) <= sum_i <= int(B):
    SUM += i
  else:
    continue
print(SUM)

# Optimized solution
# 10で割っていくやつ
[N, A, B] = list(map(int, input().split()))
sum = 0
a = 0
for i in range(1, N+1):
  n = i
  while n > 0:
    a += n % 10
    n //= 10
  if A <= a <= B:
    sum += i
    a = 0
  else:
    a = 0
    continue
print(sum)
# Original solution
N,A,B = list(map(int,input().split()))
ans = 0

for i in range(1, N+1):
    r = (i - i % 10000)
    s = (i - i % 1000)
    t = (i - i % 100)
    u = (i - i % 10)
    v = i % 10

    u = (u - t) / 10    
    t = (t - s) / 100
    s = (s - r) / 1000
    r = r / 10000
    
    if A <= s+t+u+v+r and r+s+t+u+v <= B:
        ans += i
    
print(ans)


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

for i in range(1, N+1):
    j = i
    tmp = 0
    while j != 0:
        tmp += j % 10
        j = j // 10
        
    if A <= tmp and 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):
    i=str(i)
    m=0
    for j in range(len(i)):
        m+=int(i[j])
    if m>=a and m<=b:
        ans+=int(i)

print(ans)


# Optimized solution
def sum(p):
    q=0
    while p>0:
        q+=p%10
        p=p//10
    return(q)

n,a,b=list(map(int,input().split()))
ans=0
for i in range(1,n+1):
    if sum(i)>=a and sum(i)<=b:
        ans+=i

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

# Optimized solution
n,a,b = list(map(int,input().split()))
def ketawa(i):
  ret = 0
  while(i):
    ret += i % 10
    i //= 10
  return ret

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

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

count = 0

for i in range(N+1):
    i10000 = i // 10000
    i1000 = (i-i10000*10000) // 1000
    i100 = (i-i10000*10000-i1000*1000) // 100
    i10 = (i-i10000*10000-i1000*1000-i100*100) // 10
    i1 = (i-i10000*10000-i1000*1000-i100*100-i10*10) // 1

    isum = i10000 + i1000 + i100 + i10 + i1

    if A <= isum <= B:
        count += i

print(count)


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

count = 0

for i in range(N+1):
    t = i
    tmp = 0
    while t > 0:
        s = t % 10
        tmp += s
        t = t // 10
    
    if A <= tmp <= B:
        count += i

print(count)
# Original solution
n,a,b = list(map(int,input().split(" ")))
res = []
for i in range(1,n + 1):
    string = str(i)
    string = list(string)
    string = list(map(int,string))
    t = 0
    for j in string:
        t += j
    if a <= t <= b:
        res.append(i)

total = 0
for i in res:
    total += i
print(total)
        

# Optimized solution
# coding: utf-8
# Your code here!

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)
# Original solution
N, A, B = list(map(int, input().split()))

res = 0
for i in range(1, N + 1):
    tmp = 0
    for j in str(i):
        tmp += int(j)
    if tmp >= A and tmp <= B:
        res += i
print(res)


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


def f(x):
    res = 0
    while x > 0:
        res += x % 10
        x //= 10
    return res


res = 0
for i in range(1, N + 1):
    x = f(i)
    if A <= x and x <= B:
        res += i
print(res)
# Original solution
N, A, B = list(map(int, input().split()))
answer = 0

for i in range(1, N+1):
    l = [int(x) for x in list(str(i))]
    if A <= sum(l) <= B: answer += i

print(answer)

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

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

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

for i in range(N+1):
    i = str(i)
    Sum_1 = 0
    for t in i:
        Sum_1 += int(t)
    if a <= Sum_1 <=b:
        Sum_0+=int(i)
print (Sum_0)

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

for i in range(1,N+1):
    Sum_1 = 0
    t = i
    while t != 0:
        Sum_1+=t%10
        t = t//10
        
    if a <= Sum_1 <= b:
        Sum_0+=i
print(Sum_0)
# Original solution
N,A,B = list(map(int,input().split()))
ans = 0
for i in range(int(N)+1):
    array = list(map(int,list(str(i))))
    if(sum(array)>=A and sum(array)<=B):
        ans += int(i)
print(ans)


# Optimized solution
N,A,B = list(map(int,input().split()))
ans = 0
for i in range(1,int(N)+1):
    sum = 0
    num = i
    while(True):
        sum += num%10
        num = num//10
        if(num == 0):
            if(sum >= A and sum <= B):
                ans += i
                break
            else:
                break
print(ans)
# Original solution
n,a,b = list(map(int, input().split()))
ans = 0
for i in range(1,n+1):
    ns = str(i)
    t = 0
    for j in ns:
        t+= int(j)
    if t >= a and t <= b:
        ans+=i
print(ans)    

# Optimized solution
n,a,b = list(map(int, input().split()))
ans = 0
for i in range(1,n+1):
    ti = 0
    tmp = i
    while tmp!=0:
        ti += tmp%10
        tmp = tmp//10
    if ti>=a and ti<=b:
        ans+=i
print(ans)
# Original solution
s = input().split()
N = int(s[0])
A = int(s[1])
B = int(s[2])
k = 0
for i in range(1,N+1):
  S = 0
  p = str(i)
  q = [str(c) for c in p]
  q = list(map(int,q))
  for j in range(len(q)):
    S = S + q[j]
  if A <= S <= B:
    k = k + i
print(k)
    

# Optimized solution
s = input().split()
N = int(s[0])
A = int(s[1])
B = int(s[2])
k = 0
for i in range(1,N+1):
  S = 0
  l = i
  while l >= 1:
    p = l%10
    l = l//10
    S = S + p
  if A <= S <= B:
    k = k + i
print(k)
# Original solution
N,A,B = list(map(int,input().split()))
C = [i for i in range(A,N+1)]
D = [i for i in range(A,10) if i <= B]
for c in C:
    if c >= 10:
        str_c = str(c)
        len_c = len(str_c)
        sum_c = 0
        for i in range(len_c):
            sum_c += int(str_c[i])
        if A <= sum_c <= B:
            D.append(c)
print((sum(D)))

# Optimized solution
N, A, B = list(map(int, input().split()))
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)
# Original solution
N,A,B=list(map(int,input().split()))
ans=0
for i in range(1,N+1):
  s=list(map(int,str(i)))
  s=sum(s)
  if A<=s and 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):
    k = i
    tmp = 0
    while k > 0:
        tmp += k % 10
        k = k // 10
    if tmp >= A and tmp <= B:
        ans += i
print(ans)
# Original solution
N,A,B = list(map(int,input().split()))
ans = 0
for i in range(N+1):
    n = str(i)
    a = 0
    for j in range(len(n)):
        a += int(n[j:j+1])
    if a >= A and a <= B:
        ans += i
print(ans)

# Optimized solution
N,A,B = list(map(int,input().split()))
def digit_sum(n):
    sum = 0
    while (n>0):
        sum += n%10
        n = int(n/10)
    return(sum)

ans = 0
for i in range(N+1):
    a = digit_sum(i)
    if A <= a <= B:
        ans += i
#        print(i)
print(ans)
# Original solution
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)



# Optimized solution
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)
# Original solution
n, a, b = list(map(int, input().split()))

ans = 0
for i in range(1, n+1):
    s = str(i)
    l = 0
    for j in range(len(s)):
        l += int(s[j])
    if l >= a and l <= b:
        ans += i
print(ans)

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

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

for n in range(1, N+1):
    count = 0
    n_list = n
    while True:
        count += n%10
        n = n//10
        if n==0:
            break

    if A<= count <=B:
        l.append(n_list)

for i in l:
    ans += i

print(ans) 

# Optimized solution
# 関数を使った場合
N, A, B = list(map(int, input().split()))
ans = 0

def FindSumOfDigits(x):
    count = 0
    while x>0:
        count += x%10
        x = x//10
    
    return count
    

for n in range(1, N+1):
    count = FindSumOfDigits(n)
    if A<= count <=B:
        ans += n

print(ans)
# Original solution
def digitsum(n):
    res = 0
    for i in range(5):
        res += (n//10**i)%10
    return res
n,a,b=list(map(int,input().split()))
res=0
for i in range(1,n+1):
    if a<=digitsum(i)<=b:
        res += i
print(res)

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

def digitsum(num):
    s = str(num)
    r = 0
    for c in s:
        r += int(c)
    return r

res = 0
for i in range(1,n+1):
    if a<=digitsum(i)<=b:
        res += i
print(res)
# Original solution
from sys import stdin

(n, a, b) = stdin.readline().rstrip().split()
n = int(n)
a = int(a)
b = int(b)

total=0
POW_MAX=4

for i in range(1, n+1):
    sub_total=0
    for j in range(0, len(str(i))):
        #sub_total = sub_total + math.floor(i / (10 ** j) )
        #sub_total = sub_total + i // (10 ** j)
        sub_total = sub_total + int(str(i)[j])
    if a <= sub_total and sub_total <= b:
        #print("n:%d sub_total:%d" % (i, sub_total))
        total = total + i

print(total)


# Optimized solution
from sys import stdin

(n, a, b) = stdin.readline().rstrip().split()
n = int(n)
a = int(a)
b = int(b)

total=0
POW_MAX=4

for i in range(1, n+1):
    sub_total=0
    num = i
    for j in range(0, POW_MAX+1):

        mod = num % 10
        sub_total = sub_total + mod
        sho = num // 10
        num = sho
        if sho == 0:
            break
    if a <= sub_total and sub_total <= b:
        total = total + i

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

sum = 0
for n in range(N + 1):
    wa = 0
    sn = str(n)
    size = len(sn)
    for s in range(size):
        wa += int(sn[s])
    if A <= wa and B >= wa:
        sum += n
print(sum)

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

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

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

# Optimized solution
N, A, B = [int(i) for i in input().split()]

def func_de(n):
    ans = 0
    while n/10 != 0:
        ans += n % 10
        n //= 10
    return ans

ANS = 0
for i in range(N+1):
    if A <= func_de(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):
  s=str(i)
  s=sum(list(map(int,s)))
  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):
  count=0
  for j in str(i):
    count+=int(j)
  if a<=count<=b:
    ans+=i
print(ans)
# Original solution
def ketanowa(p):
    ans=0
    p=str(p)
    for i in p:
        ans+=int(i)
    return ans

def main():
    temp=input().split(" ")
    n=int(temp[0])
    a=int(temp[1])
    b=int(temp[2])
    su=0


    for i in range(n+1):
        if  a<=ketanowa(i) and ketanowa(i)<=b:
            su+=i
    print (su)

if __name__ == '__main__':
    main()


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

print((sum(i for i in range(1, N+1) if A <= sum(int(c) for c in str(i)) <= B)))


# 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
# -*- coding: utf-8 -*-
N, A, B = list(map(int, input().split()))


def num_sum(n):
    p = list(map(int, str(n)[::-1]))
    _sum = 0
    for _i in range(len(p)):
        _sum += p[_i]
    return _sum


ans = 0
for i in range(N+1):
    if A <= num_sum(i) <= B:
        ans += i

print(ans)


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

ans = 0
for i in range(N+1):
    if A <= sum(list(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(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,list(str(i))))) <= b:
        ans += i
print(ans)
# Original solution
N,A,B = list(map(int,input().split()))
L = []
for i in range(1,N+1) :
    c = 0
    C = list(str(i))
    for j in range(len(C)) :
        c += int(C[j])
    if A <= c <= B :
        L.append(i)
print((sum(L)))



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

target_total = 0
total_each_digit = 0
n_length = 0

for n in range(1, N + 1):
    total_each_digit = 0
    n_length = len(str(n))
    
    for i in range(n_length):
        total_each_digit += int(str(n)[i])
    if A <= total_each_digit <= B:
        target_total += n

print(target_total)

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

target_total = 0

for n in range(1, N + 1):
    total_each_digit = 0
    n_length = len(str(n))
    
    for i in range(n_length):
        total_each_digit += int(str(n)[i])
    if A <= total_each_digit <= B:
        target_total += n

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

target_total = 0    # 加算対象の数値の和

for n in range(1, N + 1):
    total_each_digit = 0    # 各位の和      
    str_n = str(n)
    n_length = len(str_n)  # nの桁数
    
    for i in range(n_length):
        total_each_digit += int(str_n[i])

    if A <= total_each_digit <= B:
        target_total += n

print(target_total)

# Optimized solution
# 各位の値を足し算する処理2
def sum_each_digit(n):
    total_each_digit = 0
    while n >= 1:
        total_each_digit += n % 10
        n //= 10
    return total_each_digit


N, A, B = list(map(int, input().split()))
target_total = 0    # 加算対象の数値の和

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

    if A <= sum_each_digit(n) <= B:
        target_total += n

print(target_total)
# Original solution
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)

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

ans = 0

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

print(ans)


# Optimized solution
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)

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

ans = 0

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

for i in range(1, n+1):
    sum = 0
    num = i
    while num > 0:
        sum += num%10 # 10で割ったあまりを取得することで最下位桁を取る
        num = num//10 # 10で割った商を取得することで一桁ずらす
    if a <= sum <=b:
        ans += i

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

# Optimized solution
n,a,b=list(map(int,input().split()))
cnt=0
for i in range(1,n+1):
    if a<=sum(map(int,str(i)))<=b:
        cnt+=i
print(cnt)
# Original solution
N,A,B = list(map(int,input().split(" ")))
 
def check(n,c):
    c+=n%10
    return (c if n/10==0 else check(int(n/10),c))
 
print((sum([i for i in range(1,N+1) if A<=check(i,0)<=B])))



# 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()))

ans = 0

for n in range(N+1):
    if A <= sum(int(c) for c in str(n)) <= B:
        ans += n

print(ans)


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

ans = 0

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

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

c=0
for x in range(1,N+1):
  y=list(str(x))

  # 各桁の和を求める
  z=sum([int(a) for a in y])

  # 各桁の和がA以上B以下なら加算
  if A<=z and z<=B:
    c+=x

# 出力
print(c)
# Original solution
# -*- coding:utf-8 -*-
N, A, B = list(map(int, input().split()))

res = 0

for i in range(1, N+1):
    count = 0
    for j in range(len(str(i))):
        count += int(str(i)[j])
    if A <= count <= B:
        res += i
print(res)


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

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)
# Original solution
n, a, b = list(map(int, input().split()))
num = 0
sum1 = 0
for num in range(n+1):
    s = str(num)
    sum2 = 0
    for i in range(len(s)):
        sum2 += int(s[i])
    if sum2 >= a and sum2 <= b:
        sum1 += num
print(sum1)

# Optimized 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)
# Original solution
N, A, B = list(map(int, input('').split()))
total = 0
for x in range(1, N + 1):
  num = str(x)
  digit_total = 0
  for y in range(len(num)):
    digit_total += int(num[y])
  if digit_total >= A and digit_total <= B:
    total += x

print(total)

# Optimized solution
N, A, B = list(map(int, input('').split()))
answer = 0
for x in range(1, N + 1):
  total = sum(int(d) for d in str(x))
  if A <= total <= B:
    answer += x

print(answer)
# 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:
        list(map(int, list(str(i))))
        ans += i
print(ans)



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

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