Problem:
 Score : 200 points    Problem Statement Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).      Constraints  1 \leq N \leq 10^4  1 \leq A \leq B \leq 36  All input values are integers.         Input Input is given from Standard Input in the following format:  N  A  B       Output Print the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).        Sample Input 1 20 2 5      Sample Output 1 84  Among the integers not greater than 20 , the ones whose sums of digits are between 2 and 5 , are: 2,3,4,5,11,12,13,14 and 20 . We should print the sum of these, 84 .       Sample Input 2 10 1 2      Sample Output 2 13       Sample Input 3 100 4 16      Sample Output 3 4554

Solution (Python):
n,a,b=(int(x) for x in input().split())
c=0
d=[]
def sual(N,A,B):
  l=list('{}'.format(N))
  for y in range(len(l)):
      d.append(int(l[y]))
  e=sum(d)
  d.clear()
  if A<=e<=B:
    return True
  else:
    return False

for x in range(n):
  if sual(x+1,a,b):
    c=c+x+1
print(c)

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

Solution (Python):
N, A, B = map(int,input().split())
ans = 0
for i in range(1, N+1):
    result = sum(list(map(int, str(i))))
    if result >= A and result <= B:
        ans += i
print(ans)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, A, B = map(int, readline().split())

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

    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

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

Solution (Python):
n,a,b=map(int,input().split())
def f(x):
    m=0
    while x>0:
        m+=x%10
        x=x//10
    return m
ans=0
for i in range(n):
    
    if a<=f(i+1)<=b:
        ans+=i+1
print(ans)

Solution (Python):
N, A, B = map(int, input().split())

r = [0] * 40

for i in range(1, N + 1):
    si = str(i)
    t = 0
    for j in range(len(si)):
        t += int(si[j])

    r[t] += i

res = 0

for i in range(A, B + 1):
    res += r[i]

print(res)

Solution (Python):
N,A,B=list(map(int,input().split()))
def digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)

ans=0
for i in range(1,N+1):
  S=digitSum(i)
  if A<=S<=B:
    ans+=i
print(ans)

Solution (Python):

n, a, b = map(int , raw_input().split())
def dfs(u, q, n, a, b):
	c = 0
	if u > n:return 0

	if a <= q <= b: 
		c += u

	for d in range(0 if u else 1,10): 
		c += dfs(u * 10 + d,q + d, n, a, b)
	return c


print dfs(0, 0,n, a, b )

Solution (Python):
def sumofdigits(n):
  s = 0
  while n > 0:
    s += n % 10
    n = n // 10
  return s

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

f = 0
for i in range(1, n+1):
  s = sumofdigits(i)
  if s >= a and s <= b:
    f += i
print(f)

Solution (Python):
n, a, b = map(int, input().split())

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

Solution (Python):
N,A,B=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)

Solution (Python):
n, a, b = 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)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
tmp = 0
frag10000 = 0
frag1000 = 0
frag100 = 0
frag10 = 0
frag1 = 0
for i in range(n + 1):
    tmp = i
    frag10000 = int(tmp / 10000)
    tmp %= 10000
    frag1000 = int(tmp / 1000)
    tmp %= 1000
    frag100 = int(tmp / 100)
    tmp %= 100
    frag10 = int(tmp / 10)
    tmp %= 10
    frag1 = int(tmp)
    tmp = frag10000 + frag1000 + frag100 + frag10 + frag1
    if a <= tmp <= b:
        ans += i
print(ans)

Solution (Python):

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

def findSumOfDigits(N):
	sum = 0
	while N > 0:
		sum += N % 10
		N = N//10
	return(sum)
	
total = 0
for i in range(1, N+1):
	sum = findSumOfDigits(i)
	if (A <= sum and sum <= B):
		total += i
print(total)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
    s = str(i)
    sums = 0
    for x in s:
        sums += int(x)
    if a <= sums and sums <= b:
        ans += i
print(ans)

Solution (Python):
n,a,b=map(int,input().split())
cnt=0
for i in range(1,n+1):
  isum=0
  ii=i
  while ii>0:
    isum+=ii%10
    ii//=10
  if a<=isum<=b:
    cnt+=i
print(cnt)

Solution (Python):
n,a,b=map(int, input().split())
ans=0
for i in range(1,n+1):
  stri=str(i)
  cnt=0
  for j in range(len(stri)):
    cnt+=int(stri[j])
  if cnt>=a and cnt<=b:
    ans+=i
print(ans)

Solution (Python):
n,a,b = map(int, input().split())

def s(sum,a,b):
    t = 0
    if sum >= a and sum <= b:
        t = 1
    return t

def S(i):
    sum = 0
    while i > 0:
        sum += i%10
        i = int(i/10)
    return sum

num = 0
for i in range(1,n+1):
    sum = S(i)
    if s(sum,a,b) == 1:
        num += i
print(num)

Solution (Python):
n,a,b=map(int, input().split())
ans=0
for i in range(1,n+1):
    s=str(i)
    tmp=0
    for j in range(len(s)):
        tmp+=int(s[j])
    if a<=tmp and tmp<=b:
        ans+=i
print(ans)

Solution (Python):
N,A,B=map(int,input().split())
tt=0
for i in range(N+1):
    ans=0
    temp=str(i)
    for j in range(len(temp)):
        ans+=int(temp[j])
    if A<=ans and ans<=B:
        tt+=int(temp)

print(tt)

Solution (Python):
N, A, B = map(int, input().split())

ans = 0

for n in range(1, N+1, 1):
    l = [i for i in str(n)]
    n_sum = sum(map(int, l))
    if n_sum >= A and n_sum <= B:
        ans += n

print(ans)

Solution (Python):
N, A, B = map(int, input().split())

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

Solution (Python):
N,A,B = map(int,input().split())
res = 0

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

Solution (Python):
N, A, B = map(int, input().split())
total = 0
for i in range(N + 1):
    I = str(i)
    L = len(I)
    sum = 0
    for j in range(L):
        sum = sum + int(I[j])
    if A <= sum <= B:
        total = total + i
print(total)

Solution (Python):
N, A, B = map(int,input().split())

x = 0
ans = 0
for i in range(N + 1):
    i = str(i)
    l = len(i)
    for j in range(l):
        x += int(i[j])
    if A <= x <= B:
        ans += int(i)
    x = 0
print(ans)

Solution (Python):
N,A,B=input().split()
N=int(N)
A=int(A)
B=int(B)

total=0
for i in range(N+1):
    N_str=str(i)
    N_sum=sum(list(map(int,N_str)))
    if N_sum<=B and N_sum>=A:
        total+=i
print(total)

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

Solution (Python):
def wa(n):
    return sum(list(map(int,list(str(n)))))

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

ans = 0
for i in range(1,N+1,1):
    tmp = wa(i)
    if A<=tmp and tmp<=B:
        ans += i

print(ans)

Solution (Python):
n,a,b=map(int,input().split())
list=[]
for i in range(0,n+1):
    s1=int(i%10)
    s2=int((i-s1)%100/10)
    s3=int((i-s1-10*s2)%1000/100)
    s4=int((i-s1-10*s2-100*s3)%10000/1000)
    s5=int((i-s1-10*s2-100*s3-1000*s4)%100000/10000)
    if s1+s2+s3+s4+s5>=a and s1+s2+s3+s4+s5<=b:
        list.append(i)
print(sum(list))

Solution (Python):
N,A,B = map(int,input().split())
p = 0

def digitSum(n):
    total = 0
    for digit in str(n):
        total += int(digit)
    return total


for i in range(1,N+1):
    if A <= digitSum(i) <= B:
        p+=i
        
print(p)

Solution (Python):
def main():
    N, A, B = map(int, input().split())
    ans = 0
    for i in range(N+1):
        tw = str(i)
        tn = 0
        for j in range(len(tw)):
            tn += int(tw[j])
        if A <= tn <= B:
            ans += i
    print(ans)
main()

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

Solution (Python):
n, a, b = list(map(int, input().split()))
ans = 0


def dsum(n):
    wa = 0
    while n > 0:
        wa += n % 10
        n //= 10
    return wa


for i in range(1, n + 1):
    res = i
    if a <= dsum(i) <= b:
        ans += i

print(ans)

Solution (Python):
N,A,B = (int(X) for X in input().split())
Count = 0
for T in range(1,N+1):
    if A<=sum(int(X) for X in list(str(T)))<=B:
        Count += T
print(Count)

Solution (Python):
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N,A,B = MI()

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

Solution (Python):
N,A,B = map(int,input().split())

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

print(ans)

Solution (Python):
n,a,b = map(int,input().split())
cnt = 0

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

print(cnt)

Solution (Python):
n_a_b = input().split(' ')

n = int(n_a_b[0])
sum([int(i) for i in list(n_a_b[0])])
a = int(n_a_b[1])
b = int(n_a_b[2])

result = 0
for i in range(1, n+1):
    total = sum([int(s) for s in list(str(i))])
    if total >= a and total <= b:
        result += i

print(result)

Solution (Python):
n, a, b = map(int, input().split())
 
total = 0
for i in range(n+1):
  x = str(i)
  y = 0
  for j in x:
    y += int(j)
  if a <= y <= b:
    total += i
print(total)

Solution (Python):
N,A,B=input().split()
N=int(N)
A=int(A)
B=int(B)

def findSumOfDigits(n):
    k = 0
    sum = 0
    while n>0:
        k = n%10
        n = n//10
        sum = sum + k
    return sum

sum=0
for i in range(N+1):
    tmp = findSumOfDigits(i)
    if A<=tmp:
        if tmp<=B:
            sum = sum + i
print(sum)

Solution (Python):
N,A,B=input().split()

sum=0
for i in range(int(N)+1):
    nums = list(str(i))
    tmp = 0
    for j in nums:
        tmp = tmp + int(j)
    if int(A)<=tmp:
        if tmp<=int(B):
            sum = sum + i
print(sum)

Solution (Python):
N, A, B = map(int,input().split())
ans = 0
for i in range(N+1):
  x = str(i)
  y = 0
  for j in x:
    y += int(j)
  if A <= y <= B:
    ans += i
    
print(ans)

Solution (Python):
N,A,B=map(int,input().split())
ans=0
for i in range(1,N+1):
    temp=0
    i=str(i)
    for j in range(len(i)):
        temp+=int(i[j])
    if A<=temp<=B:
        ans+=int(i)

print(ans)

Solution (Python):
n, a, b = map(int, input().split())

ans = 0
for num in range(n):
  num += 1
  num_0 = num
  place_of_10000 = num//10000
  num -= 10000*place_of_10000
  place_of_1000 = num//1000
  num -= 1000*place_of_1000
  place_of_100 = num//100
  num -= 100*place_of_100
  place_of_10 = num//10
  num -= 10*place_of_10
  
  tmp = place_of_10000 + place_of_1000 + place_of_100 + place_of_10 + num
  if a<=tmp and tmp<=b:
    ans += num_0
    
print(ans)

Solution (Python):
def resolve():
    n, a, b = map(int, input().split())
    
    ans = 0
    for i in range(n, 0, -1):
        snum = str(i)
        total = 0
        for c in snum:
            total += int(c)
        if a <= total and total <= b:
            ans += i
    print(ans)
resolve()

Solution (Python):
in_list = input().split(' ')
N = int(in_list[0])
A = int(in_list[1])
B = int(in_list[2])

count = 0
for i in range(N+1):
    if i == 10000:
        i_4 = 1
        res_i = 0
    else:
        i_4 = 0
        res_i = i

    i_3 = int(res_i/1000)
    if i_3 != 0:
        res_i = res_i - i_3*1000
    
    i_2 = int(res_i/100)
    if i_2 != 0:
        res_i = res_i - i_2*100
    
    i_1 = int(res_i/10)
    if i_1 != 0:
        res_i = res_i - i_1*10
    
    i_0 = res_i
    i_sum = i_4 + i_3 + i_2 + i_1 + i_0
    
    

    if i_sum >= A and i_sum <= B:
        count += i
        
        

print(count)

Solution (Python):
n, a, b = map(int,input().split())

ans_list = []
for i in range(1,n+1):
    num_list = map(int,list(str(i)))
    if a<=sum(num_list)<= b:
        ans_list.append(i)

print(sum(ans_list))

Solution (Python):
N,A,B=map(int,input().split())
res = 0

def check(a):
  sumsum = 0
  while a > 0:
    sumsum += a % 10
    a = a // 10
  return sumsum

for i in range(N+1):
  if A<=check(i)<=B:
    res += i
print(res)

Solution (Python):
N,A,B = map(int,input().split())
l = list(range(1,N+1))
su = 0
for i in l:
    num_li = (list(str(i)))
    num_li = list(map(int,num_li))
    k = sum(num_li)
    if A <= k <= B:su+=i
print(su)

Solution (Python):
n,a,b = map(int,input().split())
cnt = 0
for i in range(1,n+1):
    x = sum([int(j) for j in list(str(i))])
    if a <= x <= b:
        cnt += i
print(cnt)

Solution (Python):
N,A,B= input().split()
l = [N,A,B]
N,A,B = map(int,l)

m = 0

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

    n = 0
    
    for j in range(len(str(i))):

        n += int(str(i)[j])

    if A <= n <= B:
        m += i

print(m)

Solution (Python):
N, A, B = map(int, input().split())

ans = 0

for n in range(1, N+1):
    digit_sum = sum([int(s) for s in str(n)])
    
    if A <= digit_sum <= B:
        ans += n
        
print(ans)

Solution (Python):
n, A, B = map(int, input().split())

sum_list = 0
for i in range(1, n+1):
    tmp = sum(list(map(int, str(i))))
    if A <= tmp and tmp <= B:
        sum_list += i
print(sum_list)

Solution (Python):
n, A, B = map(int, input().split())

sum_list = []
for i in range(1, n+1):
    tmp = sum(list(map(int, str(i))))
    if A <= tmp and tmp <= B:
        sum_list.append(i)
print(sum(sum_list))

Solution (Python):
from sys import stdin

n, a, b = [int(x) for x in stdin.readline().rstrip().split()]

s = 0
for i in range(n+1):
    pp = 0
    m = i
    for j in range(5):
        p = m % 10
        pp = pp + p
        m = m//10
    if pp >= a and pp <= b: s = s + i

print (s)

Solution (Python):


import sys
input=sys.stdin.readline

def main():
    N,A,B=map(int,input().split())
    cnt=0
    for i in range(1,N+1):
        ds=0
        for j in range(5):
            ds+=(int(i//(10**j)))%(10)
        if A<=ds<=B:
            cnt+=i
    print(cnt)
    
if __name__=="__main__":
    main()

Solution (Python):


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


def su(n):
  n = str(n)
  aa = 0
  for i in range(len(n)):
    aa += int(n[i])
  return aa
  

ans = 0
for i in range(1, N + 1):
  now = su(i)
  if A <= now <= B:
    ans += i
print(ans)

Solution (Python):
N, A, B = map(int, input().split())
count = 0

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

print(count)

Solution (Python):
a ,b ,c = input().split()

ans = 0

for i in range( 1 , int(a)+1 ):
    
    o = str(i)
    
    count = 0
    
    for k in range( 0 , len(o)) :
        
        count += int(o[k])
    
    if count >= int(b) and count <= int(c):
        
        ans += i
        
print(ans)

Solution (Python):
N,A,B=map(int,input().split())
ans=0
for x in range(1,N+1):
  temp=0
  for y in str(x):
    temp+=int(y)
  else:
    if temp>=A and temp<=B:
      ans+=x
print(ans)

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

Solution (Python):
N, A, B = input().split(' ')
N = int(N)
A = int(A)
B = int(B)
Num = []
Num = list(range(1, N+1))
checkbox = [0]
all = []
for i in range(N):
  cn = str(Num[i])
  for j in range(len(cn)):
    cnk = int(cn[j])
    checkbox.append(cnk)
  check = sum(checkbox)
  if A<= check <= B:
    all.append(Num[i])
  checkbox = [0]
print(sum(all))

Solution (Python):
import math


def main(n, a, b):
    def validator(x, a, b):
        total = sum([(x // (10 ** digit)) %
                     10 for digit in range(int(math.log10(n)) + 1)])
        return total >= a and total <= b
    print(sum([x for x in range(1, n + 1) if validator(x, a, b)]))


if __name__ == "__main__":
    n, a, b = [int(x) for x in input().split()]
    main(n, a, b)

Solution (Python):
N,A,B=map(int,input().split(' '))
answer = 0
for i in range(N):
  n = sum(int(j) for j in str(i+1))
  if n >= A and n <= B:
    answer += i+1
print(answer)

Solution (Python):
N, A, B = map(int, input().split())
C = 0
for i in range(1, N + 1):
    L = list(str(i))
    c = 0
    for l in L:
        c += int(l)
    if A <= c <= B:
        C += i
print(C)

Solution (Python):
MM = input().split()
N = int(MM[0])
A = int(MM[1])
B = int(MM[2])
total = 0
for i in range(N+1):
  x = list(str(i))
  total1 = 0
  for j in x:
    
    total1 += int(j)
  
  if A<= total1 <= B:
    total +=i
print(total)

Solution (Python):
n, a, b = map(int, input().split())

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

print(ans)

Solution (Python):
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
    s=sum(map(int,list(str(i))))
    if A<=s and s<=B:ans+=i
print(ans)

Solution (Python):
N,A,B = map(int, input().split())


X = [0]*10100
for i in range(len(X)):
  S = str(i)
  a = 0
  for c in S:
    a += int(c)

  X[i] = a



ans = 0
for i,x in enumerate(X[:N+1]):
  if A<=x and x<=B:
    ans += i
    

print(ans)

Solution (Python):
n, a, b = map(int, input().split())

num_lists = list(range(1, n+1, 1))
sum_lists = []
for i in num_lists:
  count = 0
  j = i
  while j >0:
    ans = j%10
    count += ans
    j = j//10
  if a <= count and count <= b:
    sum_lists.append(i)

answer = 0
for i in sum_lists:
  answer += i

print(answer)

Solution (Python):
N, A, B = map(int, input().split())
print(sum(x for x in range(1, N+1) if A<=sum((map(int, str(x))))<=B))

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


def main():
    n, a, b = map(int, input().split())
    ans = 0
    for i in range(1, n + 1):
        s = str(i)
        val = 0
        for c in s:
            val += int(c)
        if a <= val <= b:
            ans += i
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N, A, B = map(int, input().split())

def sum_of_digits(n):
   result   = 0
   quotient = n
   while quotient:
       result   +=  quotient % 10
       quotient //= 10
   return result

ans = 0
for i in range(1, N + 1):
    sd = sum_of_digits(i)
    if sd >= A and sd <= B:
        ans += i

print(ans, flush=True)

Solution (Python):
N, A, B = map(int,input().split())





count = 0
for i in range(1,N+1):
  total = 0
  string_N = list(str(i))
  length_N = len(str(i))
  
  for j in range(length_N):
    total += int(string_N[j])
  if total >= A and total <= B:
    count += i

print(count)

Solution (Python):
N,A,B = map(int,input().split())
l = 0
num = 0
Sum = 0
for i in range(1,N+1):
    i = str(i)
    l = len(i)
    for j in range(l):
        num += int(i[j])
    if A<=num and B >= num:
        Sum += int(i)
    num = 0
print(Sum)

Solution (Python):
s = input().split()
n = int(s[0])
a = int(s[1])
b = int(s[2])

sums = []

for i in range(1, n + 1):
    x = i
    check = 0
    while (x > 0):
        y = x % 10
        x = int(x / 10)
        check += y
    if a <= check <= b:
        sums.append(i)

answer = 0
for i in range(len(sums)):
    answer += sums[i]

print(answer)

Solution (Python):
N,A,B = [int(i) for i in input().split()]
ts = 0
for n in range(1,N+1):
    s = sum([int(i) for i in str(n)])
    if A <= s <= B:
        ts += n
print(ts)

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, a, b = map(int, input().split())
    r = 0
    for i1 in range(1, n + 1):
        i1sum = 0
        i1org = i1
        while i1:
            i1sum += i1 % 10
            i1 = i1 // 10
        if a <= i1sum <= b:
            r += i1org
    print(r)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, a, b = map(int, input().split())
    r = 0
    for i1 in range(1, n + 1):
        i1sum = sum(tuple(map(int, str(i1))))
        if a <= i1sum <= b:
            r += i1
    print(r)

if __name__ == '__main__':
    main()

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

Solution (Python):
n,a,b=map(int,input().split())
c=0
for i in range(1,n+1):
    s=sum([int(v) for v in str(i)])
    if a<=s<=b:
        c+=i
print(c)

Solution (Python):
n, a, b = map( int, input().split() )
sum = 0
count = 1

while count <= n:

    c_check = 0
    count_temp = count
    while 1:
        c_check += count_temp % 10
        count_temp = int(count_temp/10)
        if count_temp<1:
            break

    if a <= c_check and b >= c_check:
        sum += count

    count += 1


print("{}".format(sum))

Solution (Python):
N,A,B = map(int,input().split())
ans = 0
for i in range(N+1):
    n = i
    sum = 0
    while n > 0:
        sum += n % 10
        n = int(n/10)
    if(A<=sum<=B):
        
        ans += i
print(ans)

Solution (Python):
n,a,b=map(int,input().split())
res=0
for i in range(n+1):
    ans=0
    s=list(str(i))
    for j in s:ans+=int(j)
    if a<= ans <= b:res+=i
print(res)

Solution (Python):


n, a, b = map(int, open(0).read().split())

print(sum([i for i in range(n+1) if a <= sum(list(map(int,list(str(i))))) <= b ]))

Solution (Python):
N, A, B = map(int, input().split())

ans_list = []
for i in range(N + 1):
    n = i
    local_sum = 0
    for j in reversed(range(len(str(i)))):
        local_sum += n // (10 ** j)
        n -= n // (10 ** j) * (10 ** j)
    if A <= local_sum and local_sum <= B:
        ans_list.append(i)
print(sum(ans_list))

Solution (Python):
N,A,B = map(int,input().split())
cnt = 0
for i in range(1,N+1):
  if i<10:
    if A <= i <= B:
      cnt += i
  elif 10 <= i < 100:
    if A <= int(str(i)[0])+int(str(i)[1]) <= B:
      cnt += i
  elif 100 <= i < 1000:
    if A <= int(str(i)[0])+int(str(i)[1])+int(str(i)[2]) <= B:
      cnt += i
  elif 1000 <= i < 10000:
    if A <= int(str(i)[0])+int(str(i)[1])+int(str(i)[2])+int(str(i)[3]) <= B:
      cnt += i
  else:
    if A <= 1 <= B:
      cnt += i
print(cnt)

Solution (Python):
n, a, b = list(map(int, input().split()))
total = 0

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

Solution (Python):

import sys
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
mod = 1000000007
inf = float("INF")
def I(): return int(input().rstrip())
def IR(n): return [I() for _ in range(n)]
def LI(): return list(map(int, input().rstrip().split()))
def LIR(n): return [LI() for _ in range(n)]
def LI_(): return list(map(lambda x: int(x) - 1, input().rstrip().split()))
def LIR_(n): return [LI_() for _ in range(n)]
def F(): return float(input().rstrip())
def FR(n): return [F() for _ in range(n)]
def LF(): return list(map(float, input().rstrip().split()))
def LFR(n): return [LI() for _ in range(n)]
def S(): return input().rstrip()
def SR(n): return [S() for _ in range(n)]
def LS(): return list(sys.stdin.readline().rstrip().split())
def LSR(n): return [LS() for _ in range(n)]


n, a, b = LI()
def digitSum(i):
    s = str(i)
    ary = list(map(int, s))
    return sum(ary)
res = 0
for n in range(n+1):
    if a <= digitSum(n) <= b:
        res += n
print(res)

Solution (Python):
N,A,B = map(int, input().split())
print(sum(i for i in range(1, N+1) if A <= sum(map(int, str(i))) <= B))

Solution (Python):
INPUT = list(map(int, input().split()))

N = INPUT[0]
A = INPUT[1]
B = INPUT[2]

total_all = 0
for i in range(N+1):
    total_epoch = sum([int(j) for j in str(i)])
    if total_epoch >= A and total_epoch <= B:
        total_all += i
print(total_all)

Solution (Python):
n, a, b = map(int, input().split(" "))
sum = 0
for e in range(a, n + 1):
    c = 0
    ee = e
    while True:
        c += e % 10
        e = e // 10
        if e == 0:
            break
    if a <= c <= b:
        sum += ee
print(sum)

Solution (Python):
import sys
input = sys.stdin.readline


def read():
    N, A, B = map(int, input().strip().split())
    return N, A, B


def solve(N, A, B):
    ans = 0
    for i in range(1, N+1):
        n = i
        d = 0
        while n > 0:
            d += n % 10
            n //= 10
        if A <= d <= B:
            ans += i
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Solution (Python):
n, a, b = map(int, input().split())
cnt = 0
for i in range(1,n+1) :
    num = list(str(i))
    num = map(int, num)
    if a <= sum(num) <= b :
        cnt += i
print(cnt)

Solution (Python):

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



def sum_of_digit(n):
    res=0
    while n>0:
        res+=n%10
        n=n//10
    return res
count=0
for i in range(1,n+1):
    if a<= sum_of_digit(i) and sum_of_digit(i) <=b :
        count+=i
print(count)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(1,N+1):
    a = i
    tot = 0
    while a > 0:
        tot += a%10
        a //= 10
    if A <= tot <= B:
        ans += i
print(ans)

Solution (Python):
N, A, B = map(int, input().split())
count = 0
for n in range(1,N+1):
    s = 0
    t = n
    while (n>0):
        s = s + n%10
        n = n//10
    if s >= A and s <= B:
        count +=t
print(count)

Solution (Python):
n, a, b = map(int, input().split())
current = 1

cnt = 0

while current <= n:
    
    number = str(current)
    length = len(number)
    
    allsum = 0
    
    for i in range(length):
        allsum += int(number[i])
        
    if a <= allsum and allsum <= b:
        cnt += current
    
    current += 1

print(cnt)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for n in range(1, N+1):
    n_str = str(n)
    n_lst = list(n_str)
    n_lst = list(map(int, n_lst))
    sum_ = sum(n_lst)
    if A <= sum_ and sum_ <= B:
        ans += n
print(ans)

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

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

print(ans)

Solution (Python):
N, A, B = 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)

Solution (Python):
n, a, b = map(int, input().split()) 

result = 0

def check(n):
    sum = 0
    while n>0 :
        sum += n%10
        n//=10
    return sum

for i in range(n):
    x = check(i+1)
    if a <= x and x <= b:
        result += i+1

print(result)

Solution (Python):
n,a,b = map(int, open(0).read().split())

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

Solution (Python):
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    s=str(i)
    sum=0
    for j in range(len(s)):
        sum+=int(s[j])
    if a<=sum and sum<=b:
        ans+=i
print(ans)

Solution (Python):
def s(x):
    if x <= 9:
        return x
    else:
        return x % 10 + s(x // 10)


n, a, b = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    if a <= s(i) <= b:
        ans += i
print(ans)

Solution (Python):
N,A,B = map(int,input().split())
count = 0
for i in range(1,N+1):
    add = sum(list(map(int, str(i))))
    if A <= add and add <= B:
        count += i
        
print(count)

Solution (Python):

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

ans = 0
for i in range(1, n + 1):
    sum_digits = sum([int(c) for c in str(i)])
    if a <= sum_digits <= b:
        ans += i
print(ans)

Solution (Python):
def keta_sum(n):
    sum = 0
    while n>0:
        sum += n%10
        n = n//10 
    return(sum)
N,A,B = map(int,input().split())
SUM = 0
for i in range(1,N+1):
  ki = keta_sum(i)
  if ki >= A and ki <= B:
    SUM += i
print(SUM)

Solution (Python):
n, a, b = 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)

Solution (Python):
n, a, b = 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)

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

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
	sum_ = 0
	m = i

	while True:
		sum_ += m % 10
		m //= 10
		if not m:
			break
	if a <= sum_ <= b:
		ans += i

print(ans)

Solution (Python):
N,a,b = map(int, input().split())
sum=0
for i in range(1,N+1):
    c=0
    d=i
    while d>0:
        c+=d%10
        d//=10
    if a<=c<=b:
        sum+=i
    
print(sum)

Solution (Python):
N, A, B = list(map(int, input().split()))
res = 0
for i in range(N + 1):
    s = str(i)
    t = 0
    for _s in s:
        t += int(_s)
    if A <= t <= B:
        res += i
print(res)

Solution (Python):
N,a,b=list(map(int,input().split()))
ans=0
for i in range(1,N+1):
  h=i
  sum=0
  while i>0:
    sum+=i%10
    i=i//10
  if sum<=b and a<=sum:
    ans+=h
print(ans)

Solution (Python):
N,A,B = map(int,input().split())

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

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
    i = str(i)
    val = 0
    for j in range(len(i)): val += int(i[j])
    if A <= val <= B: ans += int(i)
print(ans)

Solution (Python):


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

ans = 0

for i in range(1, N+1):
    tmp_l = list(str(i))
    tmp_sum = 0
    for j in tmp_l:
        tmp_sum = tmp_sum + int(j)
    if A <= tmp_sum <= B:
        ans = ans + i

print(ans)

Solution (Python):
N,A,B=map(int,input().split())
souryou=0
for i in range(N):
  j=i+1
  j_str=str(j)
  goukei=0
  for k in range(len(j_str)):
    goukei=goukei+int(j_str[k])
  if goukei>=A and goukei<=B:
    souryou=souryou+j
print(str(souryou))

Solution (Python):
N, A, B = map(int, input().split())
total = 0
for i in range(N + 1):
    I = str(i)
    L = len(I)
    sum = 0
    for j in range(L):
        sum = sum + int(I[j])
    if A <= sum <= B:
        total = total + i
print(total)

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

Solution (Python):
n, a, b = map(int, input().split())
ans = []
for i in range(1, n+1):
  if a <= sum(map(int, list(str(i)))) <= b:
    ans.append(i)
print(sum(ans))

Solution (Python):
N,A,B = map(int, input().split())

ans = 0
for i in range(1,N+1):
    a = 0
    j = i
    while i != 0:
        a += i % 10
        i //= 10
    if A <= a <= B:
        ans += j

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n, a, b = map(int, input().split())

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


if __name__ == '__main__':
    main()