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 = list(map(int, input().split()))
cnt = 0
for i in range(N + 1):
	seq = list(map(int, list(str(i))))
	x = sum(seq)
	if A <= x and x <= B:
		cnt += i

print(cnt)

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

for i in range(1, n+1):
    digits = map(int, list(str(i)))
    sums = sum(digits)

    if a <= sums and sums <= b:
        ans += i

print(ans)

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

Solution (Python):

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

    m = 0
    for i in range(1, n+1):
        s = str(i)
        k = 0
        for j in s:
            k += int(j)

        if a <= k and k <= b:
            m += i

    print(m)
    

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
import numpy as np

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

def digits(data):
    
    A = data
    
    dig = int(np.log10(A) + 1)
    j   = []
    for i in range(1,dig+1):
        
        B = int(A/(10**(dig - i)))
        
        A-= B * 10**(dig - i)
        
        j = np.append(j,B)
    ans = np.sum(j)
    return int(ans) ,data

j = []
for i in range(1,N+1):
    if (A<= digits(i)[0] <=B):
        j = np.append(j,digits(i)[1])
print(int(np.sum(j)))

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

Solution (Python):
def sum_digit(num):
  sumsum = 0
  while(num > 0):
    sumsum += int(num%10)
    num /= 10

  return sumsum


if __name__ == '__main__':
  n, a, b = map(int, input().split())
  ans = 0
  for i in range(1, n+1):
    sum_num = sum_digit(i)
    if sum_num >= a and sum_num <= b:
      
      ans += i
  print(ans)

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

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

print(ans)

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

    if A <= digitsum and digitsum <= B:
        output +=  i

print (output)

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

    if A <= digitsum and digitsum <= B:
        output = output +  i

print (output)

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

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

ans=0
n=A
while n<=N:
    if(n/10<1):
        if(n<=B):
            
            ans+=n
    else:
        tmp=0
        temp=n
        while(temp!=0):
            a=temp%10
            tmp+=a
            temp=temp//10
        if(tmp<=B and tmp>=A):
            
            ans+=n
    n+=1
print(ans)

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

some_sum = 0
for i in range(1, n+1):
	digit_sum = sum([int(m) for m in str(i)])
	if a <= digit_sum and digit_sum <= b:
		some_sum += i

print(some_sum)

Solution (Python):
while True:
    s = 0
    a = input().split()
    X = [int(i) for i in a]
    N,A,B = str(X[0]), X[1], X[2]
    if (int(N) < 1 or int(N) >10001) or (A > B or B > 36 or A < 1):
        continue
    for i in range(1,int(N)+1):
        a = 0
        l = []
        l = list(map(int,list(str(i))))
        for j in l:
            a = a + j
        if a >= A and a <= B:
            s = s + i
    print(s)
    break

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

ab_list = []
for i in range(1,N+1):
	numbers = list(str(i))
	num_list = list(map(int,numbers))

	sum_numlist = 0
	for j in range(len(num_list)):
		sum_numlist += num_list[j]

	if(A<=sum_numlist and sum_numlist<=B):
		ab_list.append(i)

count = 0
for n in range(len(ab_list)):
	count += ab_list[n]

print(count)

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

Solution (Python):

"""
Created on Wed Jun 20 16:39:29 2018

@author: Yuya
"""

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

sum_k=0

for i in range(N+1):
    if i <10:
        k=i
    elif i<100:
        k=i//10+i%10
    elif i<1000:
        k=i//100+(i%100)//10+(i%100)%10
    elif i<10000:
        k=i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
    else:
        k=1
    if A<=k and k<=B:
        sum_k=sum_k+i
      
print(sum_k)

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

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

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

ans = 0
for i in range(1, N+1):
    i_s = str(i)
    s = 0
    for j in i_s:
        s += int(j)
    if A <= s <= 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, str(x))) <= b))

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

total = 0
for i in range(N+1):
    n = i
    sum = 0
    while n > 0:
        sum += n % 10
        n //= 10

    if A <= sum <= B:
        total += i

print(total)

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

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

Solution (Python):
n = 20
a = 2
b = 5

i = input()
d = i.split()
n = int(d[0])
a = int(d[1])
b = int(d[2])

sum1 = 0

for i in range(1,n+1):
    d = list(str(i))
    sum2 = 0
    for i2 in d:
        sum2 = sum2 + int(i2)
    if(a<=sum2 and sum2<=b):
        sum1 = sum1 + int(i)

print(sum1)

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

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

Solution (Python):


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

ans = 0

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

    sum1 = 0
    num = i
    
    while num > 0:
        sum1 += num % 10
        num //= 10
    
    if sum1 >= A and sum1 <= B:
        ans += i

print(ans)

Solution (Python):


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

ans = 0

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

    sum1 = 0
    num = i
    
    for j in range(len(str(i))):
        sum1 += num % 10
        num = int(num / 10)
    
    if sum1 >= A and sum1 <= B:
        ans += i

print(ans)

Solution (Python):


if __name__ == '__main__':

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

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

        sum = 0
        remainder = i

        while(remainder > 0):
            sum += remainder % 10
            remainder //= 10

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

    print(total)

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

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

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

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

Solution (Python):
n, a, b = [int(i) for i in input().split()]
ans = 0
for i in range(1, n + 1):
    sum = 0
    now = i
    while now > 0:
        sum += now % 10
        now //= 10
    if a <= sum and sum <= 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):
    sum = 0
    now = i
    while now > 0:
        sum += now % 10
        now //= 10
    if a <= sum and sum <= b:
        ans += i
print(ans)

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

    return count

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

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

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

print(res)

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

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

Solution (Python):
import numpy
import re
import math

def main():
	"""
	テストコード実行
	:return:
	"""
	n, a, b = map(int, re.split(" +", input()))
	x = 0
	for i in range(1, n + 1):
		if a <= sum(list(map(int, list(str(i))))) <= b:
			x += i
	print(x)

if __name__ == '__main__':
	main()

Solution (Python):
l = list(map(int,input().split()))
m = list(range(l[1],l[2]+1))

def digitsum(n):
    s = str(n)
    ary = list(map(int,list(s)))
    return sum(ary)

k = []
for i in range(l[0]+1):
    if digitsum(i) in m :
        k.append(i)
print(sum(k))

Solution (Python):
N,A,B = list(map(int, input().split()))
dict_sum_of_integers = {}
Answer = 0

for i in range(1, N+1):
    sum_of_digits = 0
    quotient = i
    while True:
        if quotient//10 > 0:
            sum_of_digits += quotient%10
            quotient = quotient//10
        else:
            sum_of_digits += quotient%10
            break
    dict_sum_of_integers[i] = sum_of_digits

for k in dict_sum_of_integers.keys():
    if A<=dict_sum_of_integers[k]<=B:
        Answer += k

print(Answer)

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

print(ans)

Solution (Python):
userIn = input().split()
n = int(userIn[0])
a = int(userIn[1])
b = int(userIn[2])
sum = 0
for i in range(1, n+1):
    tempSum = 0

    for j in range(5):
        tempSum += int(i/(10**j)) % 10

    if a <= tempSum and tempSum <= b:
        sum += i

print(sum)

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

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

total = 0

for i in range(N+1):
    summy = 0
    char = str(i)
    for j in range(len(char)):
        summy = summy + int(char[j])

    if (summy>=A and summy<=B):
        total = total + i
        
print(total)

Solution (Python):
import math

def main():
    num_n, num_a, num_b = list(map(int, input().split()))
    count_list = []
    for i in range(1, num_n + 1):
        
        digit_list = list(str(i))
        digit_list_int = [int(j) for j in digit_list]
        num_sum = sum(digit_list_int)
        if num_a <= num_sum and num_sum <= num_b: count_list.append(i)
    
    print(sum(count_list))

    


if __name__ == '__main__':
    main()

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

def cal(n):
    item = str(n)
    count = 0
    for i in range(len(item)):
        count += int(item[i])
    return count

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

print(count)

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

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


N_list = []
for i in range(N):
    N_list.append(int(i + 1))




N_list_str = list(map(str, N_list))
digit_sum_list = []
for i in N_list_str:
    digit_sum = 0
    
    str_length = len(i)
    
    for j in range(str_length):
        digit_sum += int(i[j])

    if A <= digit_sum <= B:
        digit_sum_list.append(int(i))
print(sum(digit_sum_list))

'''
１以上N以下の整数で各桁の和がA以上B以下の整数の和
'''

Solution (Python):
x,y,z = map(int, input().split())

ans = 0
for i in range(1, x+1):
  a = sum(map(int, list(str(i))))
  
  if y <= a <= z: ans +=i
    
print(ans)

Solution (Python):
x,y,z = map(int, input().split())

ans = 0
for i in range(1, x+1):
  a = sum(map(int, list(str(i))))
  
  if y <= a <= z: ans +=i
    
print(ans)

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

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

numlist = []
for i in range(N+1):
   num = map(int, str(i))
   if (A<=sum(num)<=B):
       list.append(numlist,i)
print(sum(numlist))

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

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

Solution (Python):

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

lst = []
for i in range(1,N+1):
    k = map(int, list(str(i)))
    a = sum(k)
    if a >= A and a <= B:
        lst.append(i)
print(sum(lst))

Solution (Python):
n,a,b = map(int,input().split())
x = 0
y = 0
for i in range(1,n+1):
    x = i
    c = i%10
    i -= c
    d = i%100
    i -= d
    e = i%1000
    i -= e
    f = i%10000
    i -= f
    g = i
    if a<=c+d//10+e//100+f/1000+g/10000<=b:
        y += x
        
    
print(y)

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

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

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

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

print(sum(sm))

Solution (Python):
n, a, b = map(int, input().split(' '))
sm = list()
for i in range(a, n + 1):
  s = sum(map(int, list(str(i))))
  if a <= s <= b:
    sm.append(i)

print(sum(sm))

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

N = int(N)
A = int(A)
B = int(B)

sum = 0
sum_digit = 0

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

print(sum)

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

Solution (Python):
lst=input().split()
ss=0
for a in range(int(lst[0])+1):
    
    s=0
    for num in str(a):
        s+=int(num)
    if int(lst[1])<=s<=int(lst[2]):
        ss+=a
print(ss)

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

print(answer)

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

print(answer)

Solution (Python):
N, A, B = list(map(int, input('').split()))
total = 0
for x in range(1, N + 1):
  num = str(x)
  digit_total = 0
  for y in range(len(num)):
    digit_total += int(num[y])
  if digit_total >= A and digit_total <= B:
    total += x

print(total)

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

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

Solution (Python):
c = []
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                c.append(i+j+k+l)
c.append(1)
n, a, b = map(int,input().split())
print(sum([i for i in list(filter(lambda i : a <= c[i] <= b, range(n+1)))]))

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

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

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

Solution (Python):
inputs = input().split()
count = 0

for num in range(1, int(inputs[0])+1):
    nums = [int(i) for i in list(str(num))]
    if sum(nums) >= int(inputs[1]) and sum(nums) <= int(inputs[2]):
        count += num
print(count)

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

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

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

Solution (Python):
input = [int(i) for i in input().split()]
N = input[0]
A = input[1]
B = input[2]

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

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

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

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

for i in range(n+1):
    ans = digit_calc(i)
    if ans >= a and ans <= b:
        total += i

print(total)

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

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

ans=0

for i in range(n+1):

    array = list(map(int,list(str(i))))
    s_1 = sum(array)
    if a <= s_1 and s_1 <= b:
        ans+=i
    

print(ans)

Solution (Python):
N, A, B = map(int, input().split())
def str_sum(strings):
    n_len = len(strings)
    res = 0
    for i in range(n_len):
        res += int(strings[i])
    return res
result = 0
for i in range(1, N+1):
    now = str(i)
    if (A <= str_sum(now)) and (str_sum(now) <= B):
        result +=int(now)
print(result)

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

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

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

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

for i in range(1,n+1):
    
    
    
    p = sum(int(j) for j in str(i))
    if a <= p <= 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())
cnt = 0
for i in range(N+1):
  sum = 0
  for s in (str(i)):
    sum += int(s)
  if sum>=A and B>=sum:
    cnt += i
print(cnt)

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

sum=0
Allsum=0
partsum=0

for i in range(N+1):
    if i<10:
        sum=i
    else:
        partsum=0
        for j in list(str(i)):
            partsum+=int(j)
        sum=partsum
    if sum>=A and sum<=B:
        Allsum+=i
print(Allsum)

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

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

N, A, B = map(int, input().split())
u = 0
for i in range(N+1):
    
    num = find_sum_of_digits(i)
    if num >= A and num <= B:
        u += i
print(u)

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

Solution (Python):
def calc_sum_digit(n):
    current_num = n
    sum_digit = 0
    for _ in range(5):
        sum_digit += current_num % 10
        current_num = current_num // 10

    return sum_digit


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

sum = 0
for i in range(1, N+1):
    sum_digit = calc_sum_digit(i)
    if (A <= sum_digit) and (sum_digit <= B):
        sum += i

print(sum)

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

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

nums = [str(x) for x in range(1,N+1)]
total = 0

for i in range(N):
	sum = 0
	l = len(nums[i])
	for j in range(l):
		sum += int(nums[i][j])
	if sum >= A and sum <= B:
		total += int(nums[i])

print(total)

Solution (Python):
n, a, b = list(map(lambda x: int(x), input().split(" ")))
count = 0
for i in range(1, n+1):
    buf = 0
    for k in str(i):
        buf += int(k)
    if a <= buf and buf <= b:
        count += i
print(count)

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

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

c = [i for i in range(a,b+1)]

count = 0

for i in range(1,n+1):
    d = list(str(i))
    d = list(map(int, list(d)))
    d = sum(d)
    if d in c:
        count += i
print(count)

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

SUM = 0
for i in range(1,N+1):
    f = sum(list(map(int,str(i))))
    if f>=A and f<=B:
        SUM += i
        
print(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):
def main():
    N, A, B = map(int, input().split())

    ans = 0

    for i in range(1, N + 1):
        tmpSum = 0
        num = str(i)
        array = list(map(int, list(num)))
        tmpSum = sum(array)

        ans += i if A <= tmpSum and tmpSum <= B else 0

    print(ans)
        
    return


if __name__ == '__main__':
    main()

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
def head_sum(x):
    sum = 0
    while x != 0:
        sum += x % 10
        x = int(x/10)
    return sum

for i in range(1, n+1):
    x = head_sum(i)
    if a <= x and x <= b:
        ans += i
print(ans)

Solution (Python):

N, a, b = map(int, input().split()) 
 
sum = 0
for x in range(N + 1):
  l = [int(y) for y in list(str(x))]
  temp_sum = 0
  for z in l:
    temp_sum += z
  if a <= temp_sum and b >= temp_sum:
     sum += x
print(sum)

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

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

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

print(ans)

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

list = []

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

print(sum(list))

Solution (Python):
def sum_among_boundaries(i, a, b):
    digits_sum = sum(map(int, str(i)))
    return digits_sum >= a and digits_sum <= b

if __name__ == '__main__':
    n, a, b = map(int, input().split())
    print(sum([i for i in range(1, n + 1) if sum_among_boundaries(i, a, b)]))

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

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

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

Solution (Python):
def modsum(n):
	m = n
	ans = 0
	while m != 0:
		ans = ans + m % 10
		m = m / 10
	
	return ans

inpt = map(int, raw_input().split())
n = inpt[0]
a = inpt[1]
b = inpt[2]
cnt = 0

for i in range(0, n):
	ms = modsum(i+1)
	if a <= ms and ms <= b:
		cnt = cnt + i+1

print cnt

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

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)

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

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

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

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

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

print(result)

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

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

Solution (Python):


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

Solution (Python):
def sum_digit(x):
    sumv = 0
    while x > 0:
        t = x % 10
        sumv += t
        x = x // 10
    return sumv

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

    ans = 0
    for num in range(a, n+1):
        sumv = sum_digit(num)
        if a <= sumv and sumv <= b:
            ans += num
    print(ans)

Solution (Python):
def sumDigit(str_digit):
    a = [int(n) for n in list(str(str_digit))]
    return sum(a)

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

print(ans)

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

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

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

Solution (Python):
def findSumOfDigits(n):
    ret = 0
    while n>0:
        ret += n % 10
        n //= 10
    return ret
 
if __name__ == '__main__':
    n, a, b = map(int, input().split())
    ttl = 0
    for i in range(1, n+1):
        sod = findSumOfDigits(i) 
        if (a <= sod) and (sod <= b):
            ttl += i
    print(ttl)

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

res = 0
for n in range(1, N+1):
    s = str(n)
    temp = 0
    for i in range(len(s)):
        temp += int(s[i])
    if temp <= B and temp >= A:
        res += n
    
print(res)