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=map(int,input().split())
l1=[]
for i in range(1,n+1):
  l=map(int,list(str(i)))
  s=sum(l)
  if s>=a and s<=b:
    l1.append(i)
print(sum(l1))

Solution (Python):
d=list(map(int,input().split()))
n,a,b=d[0],d[1],d[2]
alist=[]
for x in range(1,n+1):
    if x==10000:
        if 1>=a and 1<=b:
            alist.append(x)
    else:
        f=x%1000
        e=int((x-f)/1000)
        h=f%100
        g=int((f-h)/100)
        j=h%10
        i=int((h-j)/10)
        wa=e+g+i+j
        if wa>=a and wa<=b:
            alist.append(x)

print(sum(alist))

Solution (Python):
from sys import stdin
N,A,B=[int(x) for x in stdin.readline().rstrip().split()]
ans=0
for i in range(1,N+1):
    digit = list(map(int,str(i)))
    if A <= sum(digit) and sum(digit) <= B:
        ans+=i
print(ans)

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

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

Solution (Python):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint

import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def unite(x, y):
    
    x = root(x)
    y = root(y)
    if x == y:
        return
    
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  
        return x
    else:
        node[x] = root(node[x])  
        return node[x]
def dfs(v):
    
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  
            continue
        if visited[v2] == True:  
            continue
        dfs(v2)


n, a, b = MI()
ans = 0
for i in range(1, n+1):
    if a <= sum([int(i) for i 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):
    if a <= sum(list(map(int,str(i)))) <= b:
        ans += i
print(str(ans))

Solution (Python):
N, A, B = map(int, input().split())
a = []
for i in range(1, N+1):
    num = str(i)
    if sum(map(int, num)) >= A and sum(map(int, num)) <= B:
        a.append(i)
print(sum(a))

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

for i in range(1,N+1):
        digits_sum = 0
        for j in str(i):
            digits_sum += int(j)
        if A <= digits_sum <= B:
            number.append(i)
for k in range(len(number)):
    sum += number[k]

print(sum)

Solution (Python):
def sum(p):
    q=0
    while p>0:
        q+=p%10
        p=p//10
    return(q)

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

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

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

Solution (Python):


L = list(map(int,input().split()))
l =[]
cnt = 0

for i in range(int(L[0]+1)):
      l = [int(x) for x in list(str(i))]
      S = sum(l)
      if L[1] <= S <= L[2]:
              cnt += i

print(cnt)

Solution (Python):
n, a, b = list(map(int, input().split()))
result = 0
for i in range(1, n+1):
  total = 0
  t = i
  for j in range(5):
    total += t%10
    t = t // 10
  if a <= total <= b:
    result += i
print(result)

Solution (Python):
num1, num2, num3 = [int(i) for i in input().split()]
sum1 = 0

for index1 in range(num1+1):
    d1 = int(index1/ 10000)
    d2 = int(int(index1%10000)/1000)
    d3 = int(int(int(index1%10000)%1000)/100)
    d4 = int( int(int(int(index1%10000)%1000)%100)/10)
    d5 = index1%10

    if (d1+d2+d3+d4+d5) >= num2 and (d1+d2+d3+d4+d5) <= num3:
        sum1 += index1

print(sum1)

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

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

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

Solution (Python):
from functools import reduce
import math

def main():
    
    
    
    

    
    
    
    
    
    

    
    

    
    
    
    
    
    
    
    
    
    INF = float("inf")

    
    MOD = 10**9+7
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    N,A,B = (int(_) for _ in input().split())
    ans = 0
    for i in range(N+1):
        digit_sum = sum((int(_) for _ in list(str(i))))
        if digit_sum >=A and digit_sum<=B:
            ans += i
    print(ans)
    
if __name__ == '__main__':
    main()

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

sum = 0
for i in range(n+1):
  d_sum = 0
  for d in str(i):
    d_sum += int(d)
  if a <= d_sum <= b:
    sum += i

print(sum)

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

print(ans)

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

def digit_sum(num):
    sum = 0
    i = 1
    while num > 0:
        mod = num % (10**i)
        num = int(num / (10**i))
        sum += mod
    return sum

sum = 0
for i in range(n):
    t = digit_sum(i+1)
    if (t >= a) and (t <= b):
        sum += i+1
print(sum)

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

for num in range(1, n + 1):
  sum_num = 0
  for c_num in str(num):
    sum_num += int(c_num)
  if sum_num >= a and sum_num <= b:
    sum += num
    
print(sum)

Solution (Python):

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

  
  if A<=z and z<=B:
    c+=x


print(c)

Solution (Python):


def kakuketawa(num: int):
    return sum(list(map(int, list(str(num)))))


if __name__ == '__main__':
    N, A, B = map(int, input().split())
    
    s = 0
    for i in range(N):
        if A <= kakuketawa(i + 1) <= B:
            s += i + 1
    print(s)

Solution (Python):

x = input()
x = x.split(" ")
sum = 0
plo = [int(s) for s in x]
for i in range(1,plo[0] + 1):
    cnt = 0
    num = list(str(i))
    inte = [int(s) for s in num]
    for j in range(len(inte)):
        cnt += inte[j]
    if(cnt >=plo[1] and cnt <= plo[2]):
        sum += i
print(sum)

Solution (Python):
def sum(n):
    num = 0
    while True:
        num += int(n%10)
        n = int(n/10)
        if n == 0:
            break
    return num

def main():
    N,A,B = [int(_) for _ in input().split(" ")]
    sum_num = 0

    for n in range(1, N+1):
        num = sum(n)

        if num >= A and num <= B:
            sum_num += n

    print(sum_num)

main()

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

total = 0
for i in range(N + 1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        total += i

print(total)

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

c = 0
for _n in range(n+1):
  s = 0
  temp_n = _n
  for i in reversed(list(range(0,5))):
    m = _n // (10**i)
    s = s + m
    _n = _n - m * (10**i)
  if (s >= a and s <= b):
    c = c + temp_n
    
print("{}".format(c))

Solution (Python):
n, a, b = [int(i) for i in input().split()]
s = 0


def f(x):
	return [int(i) for i in str(x)]

for i in range(n+1):
	s+= i if a<=sum(f(i))<=b else 0

print( s)

Solution (Python):

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


ans = 0
for i in range(1,n+1):

    si = str(i)
    total = 0
    for se in si:

        total += int(se)

    ans += i if a<=total and total <= b else 0
    

print(ans)

Solution (Python):

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


ans = 0
for i in range(1,n+1):

    si = str(i)
    total = 0
    for se in si:

        total += int(se)

    ans += i if a<=total and total <= b else 0
    

print(ans)

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

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

def sumDigits(num):
    sum = 0
    while num > 0:
        sum += num % 10
        num //= 10
    return sum

for i in range(N+1):
    sum = sumDigits(i)
    if A <= sum <= B:
        answer += i

print(answer)

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



Sum = 0

for i in range(1, N + 1):
	Y = i
	Judge = 0

	while Y >= 1:
		Judge += Y % 10	
		Y = int(Y // 10)	
		

	if A <= Judge and Judge <= B:
		Sum += i


print(Sum)

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

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

for i in range(1, n+1):
  tmp = map(int, list(str(i)))
  v = sum(tmp)
  if v >= a and v <= b:
    res += i

print(res)

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

array = []
for i in range(n+1):
    wa = 0
    for s in str(i):
        wa += int(s)
    if a<=wa and b>=wa: array.append(i)
print(sum(array))

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

array = []
for i in range(n+1):
    wa = 0
    for s in str(i):

        wa += int(s)
    if a<=wa and b>=wa: array.append(i)
print(sum(array))

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

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

Solution (Python):
[n,a,b] = [int(i) for i in input().split()]
cnt = 0
for i in range(1,n+1):
  t = i
  s = 0
  while t != 0:
    s += t % 10
    t //= 10
  if s >= a and s <= b:
    cnt += i
print(cnt)

Solution (Python):
N,A,B=[int(i) for i in input().split()]
i,n=1,0
while i<=N:
  x=i%10+i//10%10+i//100%10+i//1000%10+i//10000
  if (x>=A) and (x<=B):n+=i
  i+=1
print(n)

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

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 = map(int, input().split())

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

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

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

Solution (Python):

import math

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

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    a, b, c, d = LI()
    a += b
    c += d
    ans = ["Left", "Right"]
    if a == c:
        print("Balanced")
        return
    print(ans[a < c])
    return


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


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    B()

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

num = [i for i in range(1,N+1)]
li = [sum(list(map(int, str(i)))) for i in range(1,N+1)]

result = 0
for i, j in zip(num, li):
    result += i if (j>=A and j <= B) else 0
print(result)

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

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

Solution (Python):

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


n = 0
sum = 0


for n in range(N+1):
	
	m = n//10000 + n%10000//1000 + n%1000//100 + n%100//10 + n%10
	if A <= m:
		if m <= B:
			
			sum += n

n +=1


print(sum)

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

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

print(ans)

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

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

ans = 0
for i in range(1, n+1):
    d_sum = sum([int(tar) for tar in str(i)])
    if d_sum >= a and d_sum <= b:
        ans += i

print(ans)

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

choku = []
lst=[]
for i in range(n):
    l= [int(x) for x in list(str(n))]
    x = sum(l)
    if x >= a and x <= b:
        choku.append(n)
    n -= 1
print(sum(choku))

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

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

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

print(total)

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

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

Solution (Python):
n,a,b = map (int,input().split())
ans = 0
for i in range(1,n+1):
  wa = sum(map(int,tuple(str(i))))
  if wa >= a and wa <= 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(list(map(int,[n_ for n_ in str(i)])))
    if x>=a and x<=b:
        cnt += i
print(cnt)

Solution (Python):
n,a,b = map(lambda x:int(x),input().strip().split())
res = []

for i in range(1,n+1):
    tmp = sum(list(map(lambda x:int(x),list(str(i)))))
    if tmp>=a and tmp<=b:
        res.append(i)
print(sum(res))

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


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

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

Solution (Python):
def ipt(N=0,switch=0):
    if N == 0:
        return list(map(int,input().split()))
    else:
        if switch==0:
            return [list(map(int,input().split())) for _ in range(N)]
        else:
            return [int(input()) for _ in range(N)]

n,a,b=ipt()

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

Solution (Python):
from sys import stdin


def main():
    N, A, B = [int(x) for x in stdin.readline().rstrip().split()]
    total = 0
    for i in range(1, N + 1):
        sum_ = sum([int(x) for x in str(i)])
        if A <= sum_ <= B:
            total += i
    print(total)


if __name__ == "__main__":
    main()

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

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

def sumofDigits(num):
    sumDigits = 0
    for j in range(len(num)):
        sumDigits += int(num[j])
    return sumDigits

total_sumDigits = 0

for i in range(1,N+1):
    if A <= sumofDigits(str(i)) <= B:
        total_sumDigits += i

print(total_sumDigits)

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

def sum(k):
  s = 0
  for j in range(len(k)):
    s+=int(k[j])
  return s

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

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

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

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

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

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

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

Solution (Python):

  
n,a,b=map(int,input().split())
def s(x):
        return x//10000 + x%10000//1000 + x%1000//100 + x%100//10 + x%10

sum=0

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

print(sum)

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

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


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


for i in range(1, N + 1):
    sum = ketawa(i)
    if A <= sum <= B:
        total += i

print(total)

Solution (Python):
def main():
    n, a, b = map(int, input().split())
    
    sum = 0
    for i in range(1, n+1):
        digit_sum = 0
        num = i
        while(num > 0):
            if num >= 1 and num <= 9:
                digit_sum += num
                num //= 10
            else:
                digit_sum += num % 10
                num //= 10

        if (digit_sum >= a) and (digit_sum <= b):
            sum += i

    print(sum)


if __name__ == "__main__":
    main()

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

Solution (Python):
N,A,B = map(int, input().split())
total = 0
for i in range(N + 1):
    count = 0
    n = str(i)
    length = len(n)
    
    for j in range(length):
        count += int(n[j])

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

print(total)

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

print(S)

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

for i in range(1, N+1):
    j = i
    sum_digit = 0
    while j:
        sum_digit += j % 10
        j //= 10
    if A <= sum_digit <=B:
        sum += i
        
print(sum)

Solution (Python):
n,a,b=map(int,input().split())
print(sum(list( i if a<= i%10 + (i//10)%10 +(i//100)%10 + (i//1000)%10 + (i//10000)%10 <=b \
                else 0 for i in range(n+1))))

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

total = 0

for n in range(1,N+1):
    sum = 0
    q = n
    while q != 0:
        sum += (q%10)
        q = q//10
    if (A<=sum) and (sum<=B):
        total += n

print(total)

Solution (Python):



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

Solution (Python):
N, A, B = [int(s) for s in input().split()]
r = 0;
def sumdig(n):
    r = 0;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    return r;
for n in range(1, N + 1):
    s = sumdig(n)
    if (s >= A and s <= B):
        r += n;
print(r)

Solution (Python):
def num_sum(L):
  ret = 0
  for l in L:
    ret += int(l)
  return ret

N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
  num = num_sum(list(str(i)))
  if A <= num and num <= 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(' '))
total = 0
for number in range(1, N + 1):
  total_number = 0
  for number_str in str(number):
    total_number += int(number_str)
  if total_number >= A and total_number <= B:
    total += number
print(total)

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

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

Solution (Python):
N, A, B = map(int, input().split(' '))
total = 0
for number in range(1, N + 1):
  total_number = 0
  for number_str in str(number):
    total_number += int(number_str)
  if total_number >= A and total_number <= B:
    total += number
print(total)

Solution (Python):
def sums(n):
    return(sum(list(map(int,[str(n)[i] for i in range(len(str(n)))]))))


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

print(ans)

Solution (Python):
def findSumOfDigit(n):
    
    sum_digit = 0

    while n > 0:  

        sum_digit += n % 10 
        n = int(n / 10)
        
    return sum_digit

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

ans = 0

for i in range(N+1):
    
    sum_digit = findSumOfDigit(i)
    if A <= sum_digit and sum_digit <= B:
        ans += i
        
print(ans)

Solution (Python):
N, A, B = [int(x) for x in input().split()]

def sum_each_digit(n):
    ans = 0
    div = 10000
    while div > 0:
        t = n // div
        ans += t
        n -= div * t
        div //= 10
    return ans

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

print(ans)

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

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

def solve():
    n, a, b = f()

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

solve()

Solution (Python):


ws = input()

N = int(ws.split(" ")[0])
A = int(ws.split(" ")[1])
B = int(ws.split(" ")[2])

sums = 0

for i in range(0, N + 1, 1):
  
  num = 0
  
  
  for v in list(str(i)):
    num += int(v)
    
  if num >= A and num <= B:
    sums += i
  else:
    pass
  
print(sums)

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

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

print(ans)

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

Solution (Python):
n, a, b = map(int, input().split())
res = 0
 
for i in range(1,n+1):
  sum = 0
  j=0
  while True:
    num = i//(10**j)
    if num != 0:
      num = num % 10 
      sum += num
      j+=1
    else:
      break
  if a<=sum and sum<=b:
    res += i;
 
print(res)

Solution (Python):
def main():
    N, A, B = [int(_) for _ in input().split()]

    ans = 0

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

    print(ans)

main()

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

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

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

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

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

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

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

for x in range(a+1):
  z = x
  d = 0
  while z != 0:
    d += z % 10
    z = z // 10
  if b <= d <= c:total += x
print(total)

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(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
for i in range(n+1):
    if a <= sum(list(map(int,list(str(i))))) <= b:
        ans += i
print(ans)

Solution (Python):

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


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

ans = 0

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

print(ans)

Solution (Python):

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


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

ans = 0

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

print(ans)

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

for i in range(1,N+1):
    j = sum(map(int,list(str(i))))
    if j <= B and j >= A:
        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())
c=0
for i in range(1,n+1):
  w=str(i)
  d=0
  for j in range(len(w)):
    d+=int(w[j])
  if a<=d<=b:
    c+=i
print(c)

Solution (Python):
n, a, b = list(map(int, input().split()))
c = list(range(1,n + 1, 1))
d = 0

def souwa(x):
    answer = 0
    for i in range(len(str(x))):
        b = str(x)
        a = str(b[i])
        answer += int(a)
    return answer

for i in range(len(c)):
    if souwa(c[i]) >= a:
        if souwa(c[i]) <= b:
            d += c[i]
            
print(d)

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

for x in range(a):
	if b <= sum(list(map(int, list(str(x+1))))) <= c:y += x + 1
print(y)

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

def check_a_b(n, a, b):
    sum = 0
    while n > 0:
        if sum + n%10 <= b:
            sum += n%10
            n //= 10
        else:
            return False
    if sum >= a:
        return True
    else:
        return False

ans = 0
for i in range(n+1):
    if check_a_b(i, a, b):
        ans += i
print(ans)

Solution (Python):
n,a,b=map(int,input().split())
cnt = 0
for i in range(1,n+1):
  s= i%10 + i//10%10 + i//100%10 + i//1000%10 + i//10000%10
  if a<=s<=b:
    cnt+=i
print(cnt)

Solution (Python):


n, a, b = map(int, input().split())
count = 0
for i in range(n+1):
        sum = 0
        x = str(i)
        for j in range(0,4):
                try:
                        sum += int(x[j])
                except IndexError:
                        pass
        if a <= sum and sum <= b:
                count += i
print(count)

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

n,a,b = map(int,input().split())
total = 0
for i in range(1,n+1):
    sum = findSumOfDigits(i)
    if sum >= a 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):
  if a<=sum([int(c) for c in str(i)])<=b:
    ans+=i
print(ans)