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())
count = 0
i = 1
for i in range(N+1):
    stri = str(i)
    L = len(stri)
    dec = i
    some = 0
    for j in range(L-1):
        zan = dec%10
        dec = int(dec/10)
        some += zan 
    some += dec
    if some >= A and some <= B:
        count+=i
    
print(count)

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

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

print(count)

Solution (Python):






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

s=0


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

print(s)

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

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

total = 0
for i in range(1,N+1):
    
    flag = True
    res = 0
    j = i
    while(flag):
        res = res + j%10
        j = int(j/10)
        if(j==0):
            flag = False
    if(A<=res & res<=B):
        total = total + i
print(total)

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

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

print(ans)

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

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

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

Solution (Python):
N, a, b = map(int, input().split())
count = 0
m = 0
for num in range(1,N+1):
    list = [int(n) for n in str(num)] 
    m = sum(list)
    if a <= m and b >= m:
        count += num
print(count)

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


def getSum(i):
    a = [int(x) for x in str(i)]
    sum = 0
    for x in a:
        sum += x
    return sum


ans = 0

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

print(ans)

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

cand = list(range(1, N+1))
cand = list(map(str, cand))
cand = list(map(lambda x: sum(map(int, x)), cand))
cand = list(map(lambda x: True if A <= x <= B else False, cand))

target = [x for x,t in zip(list(range(1, N+1)), cand) if t]
print(sum(target))

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

total = 0
for i in range(n+1):
    str_i = str(i)
    sub_total = 0
    for s in str_i:
        sub_total += int(s)
    if a <= sub_total and sub_total <= b:
        total += i

print(total)

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

sum2 = 0

for x in range(n+1):
    sum1 = 0
    x2 = x
    while x > 0:
        sum1 += x % 10
        x = int(x/10)

    if sum1 >= a and sum1 <= b:
        sum2 += x2
print(sum2)

Solution (Python):
a,b,c=map(int,input().split())
d=[str(i+1) for i in range(a)]

g=[]
for i in d:
	e=list(i)
	
	f=list(map(int,list(e)))
	
	g.append(sum(f))

h=0
for i in range(len(g)):
	if b<=g[i]<=c:
		h=h+int(d[i])
print(h)

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

print(cnt)

Solution (Python):
def sumd(n):
    r=0
    while n:
        r+=n%10
        n=n//10
    return r

n,a,b=map(int,input().split())
counter=0
for i in range(n+1):
    r=sumd(i)
    
    if r>=a and r<=b:
        counter+=i
print(counter)

Solution (Python):
import numpy as np
n, a, b = np.array(list(input().split()), dtype=int)

count = 0
for i in range(1, n + 1):
    s = np.array(list(str(i)), dtype=int).sum()
    if a <= s and s <= b:
        count += i
print(count)

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

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

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

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

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

def ok(a):
    s = 0
    while a > 0:
        s += a % 10
        a //= 10
    return (A <= s and s <= B)

s = 0
for i in range(1, n+1):
    if ok(i):
        s += i
print(s)

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

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

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

Solution (Python):
import functools

nums = list(map(int, input().split()))
N = nums[0]
A = nums[1]
B = nums[2]
sums = 0
i = 1

while i <= N:
    sum = functools.reduce(lambda x, y: x + y, list(map(int, list(str(i)))))
    if A <= sum and sum <= B:
        sums += i
    i += 1
print(sums)

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

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

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

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

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

Solution (Python):
import sys

input = sys.stdin.readline


def ii():
    return int(input())


def il():
    return list(map(int, input().split()))


N, A, B = il()
s = 0
for n in range(1, N + 1):
    k = [int(i) for i in str(n)]
    if A <= sum(k) <= B:
        s += n
print(s)

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

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

Solution (Python):

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


N_list = list(range(1, N+1))


N_match = []



for n in N_list:
    
    
    i = n

    
    
    R_list = []

    while True:
    
        
        R = n%10   
        R_list.append(R)    
    
        
        n = int(n/10)
    
        
        if n==0:
            break
    
    
    
    R_sum = sum(R_list)
    
    
    if A<=R_sum<=B:
        N_match.append(i)
               
print(sum(N_match))

Solution (Python):
N,A,B = map(int,input().split(" "))
list = []
for i in range(1,N+1):
    i = str(i)
    if len(str(i)) == 1:
        d = int(i)
    elif len(str(i)) == 2:
        d = int(i[0]) + int(i[1])
    elif len(str(i)) == 3:
        d = int(i[0]) + int(i[1]) + int(i[2])
    elif len(str(i)) == 4:
        d = int(i[0]) + int(i[1]) + int(i[2]) + int(i[3])
    elif len(str(i)) == 5:
        d = int(i[0]) + int(i[1]) + int(i[2]) + int(i[3]) +int(i[4])
    list.append(d)
ans = 0
for j in range(len(list)):
    if list[j] >= A and list[j] <= B:
        ans += j+1
print(ans)

Solution (Python):
a = list(int(i) for i in input().split()) 
ct = 0
for i in range (0,a[0]):
 c = int(0)
 d = int(i+1)
 for j in range(0,5):
  c += d%10
  d  = d//10
 if a[1]<=c and c <=a[2]:
  ct += i+1
print(ct)

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

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

Solution (Python):
def sum_digits(num):
    total = 0
    while num != 0:
        total += num % 10
        num //= 10
    return total

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

ans = 0

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

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

print(ans)

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

ans = 0

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

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

print(ans)

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

ans = 0

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

print(ans)

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

def find(x):
        rtn=0
        while x>0:
                rtn+=int(x%10)
                x/=10
        return rtn

for i in range(n+1):
        sum=int(find(i))
        if sum>=a and sum<=b:
                ans+=int(i)

print(ans)

Solution (Python):
n = list(map(int,input().split()))
ans = 0
count = 0
for i in range(n[0]+1):
    j = i
    ans = 0
    while(i is not 0):
        ans = ans + i%10
        i = int(i/10)
    if ans >= n[1] and ans <= n[2]:
        count = count +j
print(count)

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

Solution (Python):

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

Solution (Python):

N, A, B = map(int, input().split())
ans = 0
for x in range(1, N+1):
    z = str(x)
    sum_x = sum(int(y) for y in z)
    if A <= sum_x <= B:
        ans += x
print(ans)

Solution (Python):


def main():
    sa = input().split(' ')
    n = int(sa[0])
    a = int(sa[1])
    b = int(sa[2])

    c = 0
    for i in range(n + 1):
        k = i % 10 + int(i / 10) % 10 + int(i / 100) % 10 + int(i / 1000) % 10 + int(i / 10000) % 10
        if a <= k and k <= b:
            c += i

    print(c)


if __name__ == '__main__':
    main()

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


abc083_b()

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

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

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

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

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

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

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

Solution (Python):




def sumKeta(number):
	number2Str = str(number)
	numberLength=len(number2Str)
	thisNumberSum = 0
	ketaRange = range(0,numberLength,1)
	for i in ketaRange:
		thisNumberKeta = int(number2Str[i])
		thisNumberSum = thisNumberKeta + thisNumberSum

	return thisNumberSum


def  sumRangeCalcRange(limitNumber,fromNumber,toNumber):
	sumValue = 0
	valueRange = range(0,limitNumber+1,1)
	for nowNumber in valueRange:
		thisSum = sumKeta(nowNumber)
		if (fromNumber <= thisSum and thisSum <= toNumber):
			sumValue = sumValue + nowNumber
	answer = sumValue
	return answer


if __name__ == '__main__':
	n,a,b = map(int,input().strip().split(' '))
	solution=sumRangeCalcRange(n,a,b)
	print(solution)

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



def digitSum(s):
    x1 = s//10**4
    x2 = (s-x1*10**4)//10**3
    x3 = (s-x2*10**3-x1*10**4)//10**2
    x4 = (s-x3*10**2-x2*10**3-x1*10**4)//10
    x5 = (s-x4*10-x3*10**2-x2*10**3-x1*10**4)
    
    return x1+x2+x3+x4+x5
    

count = 0
for i in range(1,n+1):
    u = digitSum(i)
    if ((u >= a) and (u<= b)):
        
        count += i


print(count)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(N+1):
    sum = i%10 + i//10%10 + i//100%10 + i//1000%10 + i//10000
    if A <= sum <= 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(map(int, list(str(i)))) <= B:
        ans += i
print(ans)

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


if __name__ == '__main__':
    main()

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

for i in range(1,N+1):
    Sum_1 = 0
    t = i
    while t != 0:
        Sum_1+=t%10
        t = t//10
        
    if a <= Sum_1 <= b:
        Sum_0+=i
print(Sum_0)

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

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

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

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

res = 0
for i in range(1,n+1):
    if a<=digitsum(i)<=b:
        res += i
print(res)

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

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

Solution (Python):
N,A,B = [int(i) for i in input().split()]
all_sum = 0
for i in range(1,N+1) :
    degit_sum = sum([int(i) for i in list(str(i))])
    if (A <= degit_sum and degit_sum <= B ) :
        all_sum += i

print(all_sum)

Solution (Python):
def calculate_sum_of_digits(n):
    result = 0
    while n != 0:
        result += n % 10

        n //= 10

    return result


n, a, b = map(int, input().split())
result = 0
for i in range(1, n + 1):
    sum_of_digits = calculate_sum_of_digits(i)
    if a <= sum_of_digits <= b:
        result += i

print(result)

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

total = 0
for i in range(1, N+1):
  _i = i
  k=0
  for _ in range(len(str(i))):
    k += _i % 10
    _i //= 10
  if A <= k <= B:
    total += i
    
print(total)

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

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

n = int(n)
a = int(a)
b = int(b)

sum = 0

for i in range(1,n+1):
	dat = str(i)
	w_sum = 0
	for d in dat:
		w_sum = w_sum + int(d)
	if (w_sum>=a and w_sum<=b):
		sum = sum + i
	
print(sum)

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

for i in range(N+1):
    n=0
    for t in str(i):
        n += int(t)
    if A <= n <= B:
        X_list.append(i)
    
print(sum(X_list))

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

Sum=0


for i in range(N+1):
    keta=0
    l = [int(x) for x in list(str(i))]
    for j in range(len(l)):
        keta+=l[j]

    if(keta>=A and keta<=B):
        Sum+=i
    
print(Sum)

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

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

Solution (Python):
N,a,b = map(int,input().split(" "))
total= 0
ans = 0
for i in range(1,N+1):
    st_i = str(i)
    for j in range(4):
        try:
            total += int(st_i[j])
        except:
            pass


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

print(ans)

Solution (Python):

n, a, b = map(int, input().split())
n = int(n)
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):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)

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

Solution (Python):
(lambda N,A,B:print(sum([int(i) for i in range(1,N+1) if A<=sum(map(int,list(str(i))))<= B])))(**dict(zip(["N","A","B"],[int(i) for i in input().split()])))

Solution (Python):
(lambda NAB: print(sum([int(i) for i in range(1, NAB[0] + 1) if NAB[1] <= sum(map(int, list(str(i)))) <= NAB[2]])))([int(i) for i in input().split()])

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

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

some_sum = 0
for num in range(n+1):
	tmp_num = num
	
	sum_num = 0
	while tmp_num > 0:
		sum_num += tmp_num % 10
		tmp_num //= 10
	
	if a <= sum_num and sum_num <= b:
		some_sum += num
		

print(some_sum)

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

def charSum(s):
    r = 0
    for c in s:
        r += int(c)
    return r

ans = sum(list(filter(lambda x: a <= charSum(str(x)) <= b, range(1, n+1))))
print(ans)

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


def calculate_summary_of_digits(n):
    result = 0
    while n != 0:
        result += (n % 10)
        n //= 10

    return result


result = 0
for i in range(1, n + 1):
    sum_of_digits = calculate_summary_of_digits(i)
    if a <= sum_of_digits <= b:
        result += i

print(result)

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

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

counter = 0

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



for i in range(1, N + 1):	
	if sum(i) >= A and sum(i) <= B:
		counter += i

print(counter)

Solution (Python):
def getNum(x):
    sum = 0
    for i in range(len(str(x))):
        sum += int(str(x)[i])
    return sum

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

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

sum1 = 0

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

print(sum1)

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


def sum_digit(n):
    result = 0
    while True:
        result += (n % 10)
        n //= 10
        if n == 0:
            break

    return result


summary = 0
for i in range(1, n + 1):
    sum_of_digits = sum_digit(i)
    if a <= sum_of_digits <= b:
        summary += i

print(summary)

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

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

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

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

ans=0
for i in range(1, n+1):
    digit_sum = 0
    for j in str(i):
        digit_sum += int(j)
    if a <= digit_sum & digit_sum <= 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):


if __name__ == "__main__":
    n, a, b = map(int, input().split())

    val = 0
    for i in range(1, n+1):
        dum = 0
        for j in str(i):
            dum += int(j)

        if a <= dum <= b:
            val += i

    print(val)

Solution (Python):
a,b,c = map(int,input().split(" "))
count = 0
sr = []
for i in range(1,a+1):
    ar = list(str(i))
    for r in ar:
        count += int(r)
    if count >= b and count <= c:
        sr.append(i)
    count = 0
print(sum(sr))

Solution (Python):
def sumorder(k, a, b):
  arr = list(str(k))
  s = sum(list(map(int,arr)))
  
  if a<=s and s<=b:
    return True
  else:
    return False
  
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
  if sumorder(i, a, b):
    ans += i
    
print(ans)

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

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

ans = 0
plus = 0

for i in range(0,n_a_b[0]+1,1):
    num = i

    for j in range(5):
        plus = plus + num % 10
        num = int(num /10) 

    if  n_a_b[1] <= plus and plus <= n_a_b[2]:
        ans = ans + i

    plus = 0

print(ans)

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

ans = 0
plus = 0

for i in range(0,n_a_b[0]+1,1):
    num = i
    for j in range(5):
        plus = plus + num % 10
        num = int(num /10) 
        if i < 0:
            break

    if  n_a_b[1] <= plus and plus <= n_a_b[2]:
        ans = ans + i

    plus = 0

print(ans)

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

ans = 0

for i in range(0,n_a_b[0]+1,1):
    plus = i - (int(i/10) * 9 + int(i/100) * 9 + int(i/1000) * 9+ int(i/10000) * 9)

    if  n_a_b[1] <= plus and plus <= n_a_b[2]:
        ans = ans + i

print(ans)

Solution (Python):
N, A, B = map(int, raw_input().split())
res = 0
for i in range(1, N + 1):
	num = sum([int(n) for n in list(unicode(i))])
	if A <= num and num <= B:
		res += i
print res

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

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

print(count)

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

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

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

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

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

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

ok_list = []

for i in range(1, N+1):
    str_i = str(i)
    i_sum = sum(map(int, list(str(i))))
    if A <= i_sum and i_sum <= B:
        ok_list.append(int(i))
print(sum(ok_list))

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

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

s = 0


def dsum(n):
	res = 0
	while n!= 0:
		res += n%10
		n = n//10

	return res


for i in range(1,n+1):
	if (dsum(i)>=a and dsum(i)<=b):
		s +=i

print(s)

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

for i in range(n+1):
    sum = 0
    n_list = list(str(i))
    for j in range(len(n_list)):
        sum += int(n_list[j])
    
    if (sum >= a) and (sum <= b):
        all_sum += i
    else:
        pass

print(all_sum)

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

Solution (Python):
def sum(i):
	sum = 0

	while i  >= 1 :
		
		sum += i % 10
		
		i = i //10
	return sum	


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

counter = 0

for i in range(1 , N + 1 ):
	
	j = sum(i)
	
	if j >= A and j <= B :
		counter += i
		


print(counter)

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

sum_lst = []

for i in range(1, n+1):
    i_lst = list(str(i))
    sums = 0
    for j in i_lst:
        sums += int(j)
    if a <= sums <= b:
        sum_lst.append(int(i))

print(sum(sum_lst))

Solution (Python):
N,A,B=map(int,input().split())
List=[]
Correct=[]
Counter=0
n=1
M=0
while n<=N:
    M=n
    while Counter<=5:
      List.append(M%10)
      M=int(M/10)
      Counter+=1
    if A<=sum(List)<=B:
      Correct.append(n)
    List.clear()
    n+=1
    Counter=0
print(sum(Correct))

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


def division(x):
    tmp = 0
    while x > 0:
        shou,amari = divmod(x,10)
        tmp += amari
        x = shou
    return tmp


    
for i in range(n+1):
    z = division(i)
    if a <= z <= b:
        iamsum += i
print(iamsum)

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

Solution (Python):
def sum_digits(x):
        rt = ''
        for char in str(x):
            rt += char
            rt += '+'

        return eval(rt[0:-1])


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

    ans = 0
    for i in range(n+1):
        if a <= sum_digits(i) <= b:
            ans += i

    return ans

  
if __name__ == '__main__':
  print(some_sums())

Solution (Python):
n, low, high = map(int, input().split())
ans = 0
save = 0

def keisan(j):
    goukei = 0
    while j > 0:
        goukei += int(j % 10)
        j = int(j / 10)
    return goukei
            
for i in range(n + 1):
    save = keisan(i)
    if low <= save <= high:
            ans += i
print(ans)

Solution (Python):
N, A, B = map(int,input().split())
sum = 0
for i in range(1, N+1):
    s_sum = 0
    j = i
    while True:
        if j >= 10:
            s_sum += j % 10
            j = j // 10
        else:
            s_sum += j
            break
    if A <= s_sum and s_sum <= B:
        sum += i
print(sum)

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

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

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

Answers = []
for i in range(1,N+1):
    Nums = str(i)
    Sum = 0
    for num in Nums:
        Sum += int(num)
    if A <= Sum <= B:
        Answers.append(i)
print(sum(Answers))

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())
r = 0

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

print(r)

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

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

def sum_digit(x):
    y = sum(int(digit) for digit in str(x))
    return y

result = []
for i in range(n+1):   
    z = sum_digit(i)
    if(int(z)<=b and int(z)>=a):
        result.append(i)
        
print(sum(result))

Solution (Python):
N,A,B=map(int,input().split())
i=1
count=0
while i<=N:
    s=str(i)
    c=0
    for ss in s:
        c+=int(ss)
    if c>=A and c<=B:
        count+=i
    i+=1
print(count)

Solution (Python):
import sys

num = raw_input().strip().split()
ans = 0

for i in range(1, int(num[0])+1):
    cnt = 0
    a = i
    while a !=0:
        cnt += a%10
        a = a/10
    if cnt >= int(num[1]) and cnt <= int(num[2]):
        ans += i
print(str(ans))

Solution (Python):
import sys

def sum_keta(num):
    tmp = num
    res = 0
    while tmp != 0:
        res += (tmp % 10)
        tmp = int(tmp/10)
    return res

n, a, b = list(map(int, sys.stdin.readline().strip().split(" ")))

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

print(r)

Solution (Python):
N, A, B = map(int, raw_input().split())
ans = 0
for i in range(1, N+1):
  x = sum(map(int, list(str(i))))
  if x >= A and x <= 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 func(x):
    if x == 0: return 0
    return func(x // 10) + (x % 10)


if __name__ == '__main__':
    n, a, b = map(int, input().split())

    i = 1
    ans = 0
    while i <= n:
        if a <= func(i) <= b:
            ans += i
        i += 1

    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):
from sys import stdin


def main() -> None:
    n, a, b = [int(next_str()) for _ in range(3)]
    ans = 0

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

    print(ans)


def sum_of_digits(a: int) -> int:
    result = 0
    while a != 0:
        result += a % 10
        a //= 10
    return result


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()