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):




import sys
from fractions import gcd
import math
from math import ceil,floor
import collections








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



ans = 0
for i in range(A,N+1):
    tmp = 0
    string = str(i)
    for j in range(0,len(string)):
        tmp += int(string[j])
    if A<=tmp & tmp<=B:
        ans += i


print(ans)

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

while p <= n:
    str_p = str(p)
    for q in str_p:
        r += int(q)
    if r >= a and r <= b:
        ans += p
    p += 1
    r = 0

print(ans)

Solution (Python):
N, A, B =map(int, input().split())
R = N // 10000
S = N // 1000
T = N // 100
U = N // 10
V = N % 10
total = 0
for r in range(R +1):
  for s in range(10): 
    for t in range(10):
      for u in range(10):
        for v in range(10):
          if A <= r+s+t+u+v and r+s+t+u+v <= B and 10000*r+1000*s+100*t+10*u+v <=N:
            total = total + 10000*r+1000*s+100*t+10*u+v
print(total)

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

res =0

for i in range(N+1):
    s = str(i)
    l = len(s)
    sum = 0
    
    for j in range(l):
        sum += int(s[j])
        
    if sum >=A and B>=sum:
        res += i
        
        
print(res)

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

ans = 0

for i in range(1,N+1,1):
  s = str(i)
  sum=0
  for j in range(len(s)):
    sum+=int(s[j])
  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)
	sum = 0
	for c in s:
		sum += int(c)
	if a <= sum <= b:
		ans += i
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
def divi(n):
    n1 = n%10
    n2 = n//10 %10
    n3 = n//100 %10
    n4 = n//1000 %10
    n5 = n//10000 %10
    return n1, n2, n3, n4, n5
ans = 0
for j in range(1,n+1):
    count = 0
    for s in divi(j):
        count += s
    if a<=count<=b:
        ans += j
print(ans)

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

for i in range(N+1):
    j=i
    n=0
    while True:
        n+=i%10
        if i//10==0:
            break
        else:
            i=i//10
    if A<=n<=B:
        a.append(j)
    else:
        pass
print(sum(a))

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

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

Solution (Python):

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

s=0
for i in range(n+1):
    x = i
    m = 0
    while x:
        m += x % 10
        x //= 10
    if a <= m <= b:
        s += i
print(s)

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

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

sum1 = 0

for i in range(1,n+1):
  sum = 0
  N = list(str(i))
  for j in N:
    sum += int(j)
  
  if a<=sum <= b:
    sum1 += i
    
print(sum1)

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

ans = 0
for i in range(1, N + 1):
    j = i
    l = []
    while i > 0:
        l.append(i % 10)
        i //= 10

    c = sum(l)
    if c >= A and c <= B:
        ans += j

print(ans)

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

ans = 0

for x in range(1, N + 1):
    SUM = 0
    num = x
    while x > 0:
        SUM += (x % 10)
        x //= 10
    if A <= SUM <= B:
        ans += num

print(ans)

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

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

print(ans)

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

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

ans = 0

for i in range(N+1):
    d1 = int(i%10)
    d2 = int(i//10%10)
    d3 = int(i//100%10)
    d4 = int(i//1000%10)
    d5 = int(i//10000%10)
    d = d1+d2+d3+d4+d5
    if d >= a and d <= b:
        ans +=i

print(ans)

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

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

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 = input().split()
s = []
c = 0
arr = []
ans = []

for i in range(1,int(n)+1):
  arr.append(str(i))


for i in range(0,len(arr)):
  tmp = 0
  for j in range(0,len(arr[i])):
    tmp += int(arr[i][j])
    
  s.append(tmp)

for i in range(0,len(s)):
  if(s[i] >=int(a) and s[i] <= int(b)):
    ans.append(i+1)
    
print(sum(ans))

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

for i in range(1, n + 1):
    tmp = i
    x = 0
    for j in range(5)[::-1]:
        x += tmp // (10**j)
        tmp = tmp - (tmp // (10**j))*(10**j)
        
    if a <= x <= b:
        sum += i
        
print(sum)

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

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

Solution (Python):
N,A,B = map(int,input().split())
sum = 0
array = []
for i in range(1,N+1):
    array.append(list(str(i)))

for i in range(N):
    value = 0
    for j in range(len(array[i])):
        value += int(array[i][j])
    if A <= value <= B:
        sum += int(''.join(array[i]))
print(sum)

Solution (Python):

N,A,B= 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)

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

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())
print(sum(i for i in range(1, N+1) if A <= sum(map(int, str(i))) <= B))

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

Solution (Python):
n, a, b = map(int,input().split(' '))
total = 0
for num in range(1,n+1):
    split_nums = [int(s) for s in list(str(num))]
    sum = 0
    for s in split_nums:
        sum += s
    if a <= sum and sum <= b:
        total += num
print(total)

Solution (Python):

import sys
sys.setrecursionlimit(10**7)

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

ans = 0









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

print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10**7)

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

ans = 0









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

print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10**7)

n, a, b = 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)

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

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

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

for i in range(1, N+1):
    sums = i//10000 + (i%10000)//1000 + (i%1000)//100 + (i%100)//10 + i%10
    if sums >= A and sums<= B:
        score += i

print(score)

Solution (Python):

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

count = 0

for i in range(n):

    s = str(i + 1)
    array = list(map(int, s))
    total = sum(array)

    if a <= total <= b:
        count += (i + 1)

print(count)

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

count = 0
sum1 = 0

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

Solution (Python):
def num_list(n):
    le = len(str(n))
    m = []
    for j in range(le):
        if j == le-1:
            m.append(n % 10)
        elif 0 < j < le-1:
            x = (n % (10 ** (le - j))) // (10 ** (le - j - 1))
            m.append(x)
        elif j == 0:
            m.append(n // (10 ** (le - 1)))
    return m


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

total = 0
for i in range(1, N+1):
    y0 = num_list(i)
    y = sum(num_list(i))
    if A <= y <= B:
        total += i
print(total)

Solution (Python):
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))

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):
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)

Solution (Python):
N,A,B=map(int,input().split())
ans=0
for n in range(N+1):
  l=list(str(n))
  L=[int(n) for n in l]
  if A<=(sum(L))<=B:
    ans+=n
print(ans)

Solution (Python):

def invr():
    return(map(int, input().split()))


def sum_of_digits(n):
    s = 0
    while n > 0:
        s += n % 10
        n = n // 10
    return s


N, A, B = invr()

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

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


if __name__ == "__main__":
    main()

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

n_list = list(range(0,n + 1))

result_sum = 0
for i in n_list :
    i_str = list(str(i))
    
    i_sum = 0
    for t in i_str :
        i_sum = i_sum + int(t)
    
    if i_sum >= a and i_sum <= b :
        result_sum = result_sum + i
print(result_sum)

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):
vals=input().split(' ')
N=int(vals[0])
A=int(vals[1])
B=int(vals[2])

total=0

number=1
while number<=N:
  subtotal=0
  for n in str(number):
    subtotal+=int(n)
  if A<= subtotal & subtotal <= B:
    total+=number
  number+=1

print(total)

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

ans = 0

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

print(ans)

Solution (Python):

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

Solution (Python):
def ds(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)

n,a,b = map(int,input().split())
y=[]
for i in range(n+1):
    x = ds(i)
    if x >= a:
        if x <= b:
            y.append(i)
print(sum(y))

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, a, b = list(map(int, readline().split()))
ans = 0
for i in range(n+1):
    y = list(str(i))
    y = [int(z) for z in y]
    if a <= sum(y) <= b:
        ans += i
print(ans)

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

ans = 0

for i in range(1, n + 1):
    digit = i
    digit_sum = 0
    while digit > 0:
        digit_sum += digit % 10
        digit = digit // 10

    if digit_sum >= a and 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_l = list(str(i))
    i_sum = sum(list(map(int, i_l)))
    if a <= i_sum <= b:
        ans += i
print(ans)

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

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, A, B = map(int, read().split())
count = 0

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

print(count)

Solution (Python):
n,a,b=(int(x) for x in input().split())
amount=0
for i in range(1,n+1):
  append = 0
  num = list(str(i))
  for j in range(len(num)):
    append+=int(num[j])
  if append>=a and append<=b:
    amount+=i
print(amount)

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


answer=0
for n in range(N+1):
    sum=0
    for i in str(n):
        sum+=int(i)
    if A<=sum and sum<=B:
        answer+=n
print(answer)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def Yes(): print("Yes"); return
def No(): print("No"); return


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





N,A,B = inputIL()
ans = 0
for i in range(1,N+1):
  if A<= sum(int(x) for x in 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):
    s = sum(list(map(int, str(i))))
    if a <= s <= b:
        ans += i
print(ans)

Solution (Python):
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)

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


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

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

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

res = 0
for i in range(1, N + 1):
    cnt = 0
    tmp = i
    while tmp > 0:
        cnt += tmp % 10
        tmp //= 10
    if A <= cnt <= B:
        res += i
print(res)

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

Solution (Python):
n,a,b=map(int,input().split())
number=[]
for i in range(1,n+1):
    number.append(i)

number_2=[]
for i in number:
    number_2.append(str(i))

sum=[]
c=0
for i in range(len(number_2)):
    for j in number_2[i]:
        c+=int(j)
    sum.append(c)
    c=0

ans=0
for i in range(len(sum)):
    if a<=sum[i]<=b:
        ans+=number[i]
print(ans)

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

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

ans = 0

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

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

wholeSum = 0

def digitSum(n):
  result = sum(map(int, list(str(n))))
  return result
  

for pivot in range(n+1):
  target = digitSum(pivot)
  if target <= b\
  and a <= target:
    wholeSum += pivot

print(wholeSum)

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

wholeSum = 0

def digitSum(n):
  basis = 10
  transDigit = list()
  while n > 0:
    transDigit.append(n % basis)
    n = int(n / basis)
  result = sum(transDigit)
  return result

for pivot in range(n+1):
  target = digitSum(pivot)
  if target <= b\
  and a <= target:
    wholeSum += pivot

print(wholeSum)

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

wholeSum = 0

def digitSum(n):
  basis = 10
  transDigit = list()
  while n > 0:
    transDigit.append(n % basis)
    n = int(n / basis)
  result = sum(transDigit)
  return result

for pivot in range(n+1):
  target = digitSum(pivot)
  if target <= b\
  and a <= target:
    wholeSum += pivot

print(wholeSum)

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

wholeSum = 0

def digitSum(n):
  result = sum(map(int, list(str(n))))
  return result
  

for pivot in range(n+1):
  target = digitSum(pivot)
  if target <= b\
  and a <= target:
    wholeSum += pivot

print(wholeSum)

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

res = 0

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

print(res)

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

sum = 0

for i in range(1,N+1):
  p = 0
  for k in str(i):
    p += int(k)
    if p > B:
      break
  if A <= p and p <= B:
    sum += i
print(sum)

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

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

print(result)

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

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

print(result)

Solution (Python):

import sys


def solve(N: int, A: int, B: int):
    total = 0
    for i in range(1, N + 1):
        keta4, mod = divmod(i, 10000)
        keta3, mod = divmod(mod, 1000)
        keta2, mod = divmod(mod, 100)
        keta1, mod = divmod(mod, 10)
        ketasum = keta4 + keta3 + keta2 + keta1 + mod
        if ketasum >= A and ketasum <= B:
            total = total + i
    return total



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    print(solve(N, A, B))

if __name__ == '__main__':
    main()

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

ans = 0
for i in range(1, n+1):
    l = list(str(i))
    total = sum([int(i) for i in l])
    if a <= total <= b:
        tmp = int("".join(l))
        ans += tmp
print(ans)

Solution (Python):
in_all = list(map(int, input().split()))
 
total = 0
for n in range(1, in_all[0]+1):
    tmp = str(n)
    all = 0
    for t in tmp:
        all += int(t)
    if all>=in_all[1] and all<=in_all[2]:
        total += n
 
print(total)

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

total = 0
for n in range(1, in_all[0]+1):
    all = 0
    tmp = n
    while tmp!=0:
        all += tmp%10
        tmp = tmp//10
    if all>=in_all[1] and all<=in_all[2]:
        total += n

print(total)

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

total = 0
for n in range(1, in_all[0]+1):
    tmp = str(n)
    all = 0
    for t in tmp:
        all += int(t)
    if all>=in_all[1] and all<=in_all[2]:
        total += int(tmp)

print(total)

Solution (Python):
n,a,b = [int(x) for x in input().split()]
def func(num):
  r = 0
  while num > 0:
    r += num % 10
    num = num // 10
  return r
total = 0
for i in range(1, n+1):
  num = func(i)
  if num >= a and num <= b:
    total += i
print(total)

Solution (Python):
num, lower, upper = map(int, input().split())

result = 0
for tmp in range(num + 1):
    sumOfNum = sum(map(int, list(str(tmp))))
    if lower <= sumOfNum and sumOfNum <= upper: result += tmp

print(result)

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

ans = 0

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

print(ans)

Solution (Python):
n,a,b=map(int,input().split())
sumall=0
for i in range(1,n+1):
    n1=int(i/10**4)
    n2=int((i-n1*10**4)/10**3)
    n3=int((i-n1*10**4-n2*10**3)/10**2)
    n4=int((i-n1*10**4-n2*10**3-n3*10**2)/10)
    n5=int(i-n1*10**4-n2*10**3-n3*10**2-n4*10)
    if (n1+n2+n3+n4+n5)>=a and (n1+n2+n3+n4+n5)<=b:
        sumall=sumall+i
print(sumall)

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

def total (x:int):
    total = 0
    while True:
        if x == 0:
            return total
        else:
            total += x%10
            x = x//10

ans = 0
for i in range(0,n+1):
    t = total(i)
    if a <= t and t <= b:
        ans += i

print (ans)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(n + 1):
	if a <= sum(map(int, 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):
	tmp = 0
	num = str(i)
	for nu in num:
		tmp += int(nu)
	if a <= tmp <= b:
		ans += i
print(ans)

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

Solution (Python):
num_list=list(map(int,input().split()))
ans = 0
for i in range(num_list[0]+1):
    str_target = str(i)
    p=0
    for n in str_target:
      p += int(n)
    if num_list[1]<= p and p<=num_list[2]:
        ans += i

print(ans)

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

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

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

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

print(ans)

Solution (Python):
import sys

input = sys.stdin.readline

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

def main():
    ans = 0
    N, A, B = map(int, input().split())
    for i in range(1, N+1):
        temp = calc(i)
        if A <= temp <= B:
            ans += i

    print(ans)

if __name__ == '__main__':
    main()

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

c = 0
for s in range(1, n+1):
    sum = 0
    r = s
    for t in range(1, len(str(s))+1):
        sum += r%10
        r = r//10
    if(a <= sum <= b):
        c += s
print(c)

Solution (Python):
import math
import copy

neko = 0

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

for i in range(1,n+1):
    if i:
        nya += i%10
    if i >= 10:
        nya += i//10%10
    if i >= 100:
        nya += i//100%10
    if i >= 1000:
        nya += i//1000%10
    if 10000 == i:
        nya += 1
    if (a<=nya)and(nya<=b):
        neko += i
    nya = 0
print(neko)

Solution (Python):
N,a,b = map(int,input().split())
c = 0

for i in range(N+1):
    i = str(i)
    listi = list(i)
    listi = [int(s) for s in listi]
    sumi = sum(listi)
    
    if sumi <= b and sumi >= a:
        c = c + int(i)

print(c)

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

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

for i in range (n+1):
    i_10000 = i//10000
    i_1000 = i%10000//1000
    i_100 = i%1000//100
    i_10 = i%100//10
    i_1 = i%10
    i_sum = i_10000 + i_1000 + i_100 + i_10 + i_1
    if a<=i_sum<=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):
    val = sum(list(map(int, list(str(i)))))
    if a <= val <= b:
        ans += i

print(ans)

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

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

Solution (Python):

n,a,b = map(int,input().split())
total_sum = 0
for i in range(n+1):
  s = str(i)
  digit_sum = 0
  for j in range(len(s)):
    digit_sum += int(s[j])
  if a <= digit_sum <= b:

    total_sum += i

print(total_sum)

Solution (Python):
import numpy as np
n, a, b = map(int, input().split()) 
numbers = np.arange(1, n+1)
collect = []
for i in numbers:
    if i < 10:
        if (i >= a) and (i <= b):
            collect.append(i)
    else:
        divide_number_str = list(str(i))
        divide_number = list(map(int, divide_number_str))
        sum_num = sum(divide_number)
        if (sum_num >= a) and (sum_num <= b):
            collect.append(i)
        
print(sum(collect))

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

def judge_sum(s, A, B):
    s = str(s)
    ans = 0
    for i in range(len(s)):
        ans += int(s[i])
    return A <= ans <= B

li = [i for i in range(1, N+1) if judge_sum(i, A, B)]

print(sum(li))

Solution (Python):
def func(x, y, total):
    if y == 0:
        return total
    else:
        total += x // y
        new_x = x % y
        new_y = y // 10
        return func(new_x,new_y,total) 

n, a, b = [int(i) for i in input().split()]

ans = sum([
	i for i in range(1, n+1)
	if a <= func(i, 10**4, 0) <= b])
print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def keta(x):
    res = 0
    for s in str(x):
        res += int(s)
    return res


def main():
    N, A, B = map(int, input().split())
    ans = 0
    for i in range(1, N + 1):
        tmp = keta(i)
        if A <= tmp <= B:
            ans += i

    print(ans)


if __name__ == "__main__":
    main()

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

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

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

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

Solution (Python):
import numpy as np
N, A, B = map(int, input().split())

total = 0
for i in range(1, N+1):
  a = i
  lis =[]
  while i >0:
    lis.append(i%10)
    i //=10
  lis.reverse()
  lis = np.array(lis)
  SUM = np.sum(lis)

  if SUM >=A and SUM <=B:
    total += a
    
print(total)

Solution (Python):
Number_list=list(map(int,input().split()))
taget_number=[]
for i in range(1,Number_list[0]+1):
    sum_digit=0
    for s in str(i):
        sum_digit+=int(s)
    if sum_digit>=Number_list[1] and sum_digit<=Number_list[2]:
        taget_number.append(i)
print(sum(taget_number))

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

Solution (Python):

n, a, b = 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)

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

for i in range(n+1):
    keta_wa = 0
    x = i
    while x != 0:
        keta_wa += int(x % 10)
        x = int(x /10)
        
    
    if a <= keta_wa <= b:
        ans += i 

print(ans)

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

for i in range(n+1):
    keta_wa = 0
    x = i
    while x != 0:
        keta_wa += int(x % 10)
        x /= 10
        
    
    if a <= keta_wa <= b:
        ans += i 

print(ans)

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

for i in range(n+1):
    check = 10000
    keta_wa = 0
    x = i
    while x != 0:
        keta_wa += int(x / check)
        x = x % check
        check /= 10
        
    
    if a <= keta_wa and keta_wa <= b:
        ans += i 

print(ans)