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

nl = [str(i) for i in range(1, n+1)]
r = 0
for ns in nl:
    score = sum(list(map(int, ns)))
    if a <= score <= b:
        r += int(ns)

print(r)

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

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


def f(x):
    s = str(x)
    arr = list(map(int, s))
    return sum(arr)


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

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

l = list(map(int, input().split()))

total = 0
for i in range(l[0]+1):
    
    digit = digitSum(i)
    if l[1] <= digit and digit <= l[2]:
        total += i

print(total)

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

res = 0
for i in range(n+1):
    t = get_sum(i)
    if(a <= t and t <= b):
        res = res + i

print(res)

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

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

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

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

print(total)

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

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

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

print(t)

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

Solution (Python):
N, low_A, up_B = map(int, input().split())
ans = 0

for i in range(1, N + 1):
    keta = list(str(i))
    summ = sum([int(i) for i in keta])
    
    if (low_A <= summ and summ <= up_B):
        ans += i

print(ans)

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

for i in range(n + 1):
  _tmp = list(str(i))
  counter = 0
  for j in _tmp:
    counter += int(j)
  if a <= counter <= b:
    ans += i
print(ans)

Solution (Python):
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

N,A,B=MI()

def calc(n):
    temp=0
    for i in range(5):
        temp+=n%10
        n=n//10
    return temp


ans=0
for i in range(N):
    n=i+1
    temp=calc(n)
    if temp>=A and temp<=B:
        ans+=n
        
print(ans)

Solution (Python):
n, a, b = [int(e) for e in input().split()]
ans = 0
for ni in range(1, n + 1):
    if a <= sum([int(c) for c in str(ni)]) <= b:
        ans += ni

print(ans)

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

ans = 0

for i in range(1, N+1):
    str_num = str(i)
    digit_sum = 0
    for c in str_num:
        n = int(c)
        digit_sum += n
    if digit_sum >= A and digit_sum <= B:
        ans += i

print(ans)

Solution (Python):
length,mi,ma = map(int,input().split())
summ = 0
for i in range(1,length + 1):
  s = str(i)
  arr = list(map(int,s))
  su = sum(arr)
  if(su <= ma and su >= mi):
    summ += i
print(summ)

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

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

Solution (Python):
def main():
    num = list(map(int, input().split()))
    total_sum = 0
    for i in range(1,num[0]+1):
        current = i
        current_sum=0
        while i >=1:
            current_sum += int( i %10)
            i = i//10
        if ((current_sum >= num[1]) and (current_sum <= num[2])):
            total_sum += current
    print(total_sum)
main()

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

l =[i for i in range(1,n+1)]

x = 0
for j in range(n):
     y = [int(i) for i in str(l[j])]
     if sum(y) >=a and sum(y) <=b:
         x += l[j]

print(x)

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

ans = 0
for i in range(1, n+1):
    s = str(i)
    ss = 0
    for k in range(len(s)):
        ss += int(s[k])
    if a<=ss<=b:
        ans += int(s)
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())

sum = 0

for i in range(1,N+1):
    small_sum =0
    for j in list(str(i)):
        small_sum += int(j)
    if small_sum >= A and small_sum <= 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):
n, a, b = map(int, input().split())

def calc(x):
    return int(x / 10), x % 10

def func(x, ans):
    a, b = calc(x)
    ans += b
    if a == 0:
        return ans
    return func(a, ans)

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

print(ans)

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

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

print(tmp)

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

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

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

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

print(ans)

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

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

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

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

def sums(n):
    x=0
    while n>0:
        x+=n%10
        n=n//10
    return x

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

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

total = 0

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

    p = i // 10000 + (i % 10000) // 1000 + (i % 1000) // 100 + (i % 100) // 10 + (i % 10)

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

print(total)

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

result = 0

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

print(result)

Solution (Python):
Nu,A,B = map(int, input().split())
ans = 0
for j in range(0,10):
    for k in range(0,10):
        for l in range(0,10):
            for m in range(0,10):
                if A <= j+k+l+m <= B:
                    num = j*1000 + k*100 + l*10 + m
                    if num <= Nu:
                        ans+=num

if A == 1 and Nu ==10000:
    ans += 10000

print(ans)

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

for i in range(N+1):
    c = 0
    t = i
    while t > 0:
        c += t % 10
        t //= 10
    if c >= A and c <=B:
        goukei += i
print(goukei)

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

for i in range(N+1):
    c = 0
    t = i
    while t > 0:
        c += t % 10
        t //= 10
    if c >= A and c <=B:
        goukei += i
print(goukei)

Solution (Python):

n,a,b = [int(i) for i in input().split()]
count_list = []
for j in range(1,n+1):
    num = sum([int(k) for k in str(j)])
    if a<= num <=b:
        count_list.append(j)


        

    
print(sum(count_list))

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

for i in range (n+1):
  u=i//10000
  v=(i-10000*u)//1000
  x=(i-10000*u-1000*v)//100
  y=(i-10000*u-1000*v-100*x)//10
  z=(i-10000*u-1000*v-100*x-10*y)
  if a<=u+v+x+y+z<=b:
    kei+=i
print(kei)

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
Sum=0
for i in range(1,n+1):
  Sum=0
  x=i
  for j in range(len(str(i))):
    Sum+=x%10
    x//=10
  if a<=Sum<=b:
    ans+=i
print(ans)

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


def func(x):
    ans = 0
    while x > 0:
        ans += x % 10
        x = x // 10

    return ans


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

print(ans)

Solution (Python):

N,A,B = input().split(" ")
N = int(N)
A = int(A)
B = int(B)
NC = [0,0,0,0,0]

answer = 0
for i in range(N+1):
  NC[4] = i // 10000
  NC[3] = (i - NC[4] * 10000)// 1000
  NC[2] = (i - NC[4] * 10000 - NC[3] *1000) // 100
  NC[1] = (i - NC[4] * 10000 - NC[3] *1000 - NC[2] * 100) //10
  NC[0] = i % 10
  sum = 0
  for j in range(5):
    sum = sum + NC[j]
  if(A <= sum and sum <= B):
    answer = answer + i
print(answer)

Solution (Python):
def get_digits_sum(num):
    result = 0
    while num > 0:
        result += num % 10
        num //= 10
    return result


def main():
    limit, digit_sum_lower, digit_sum_upper = map(int, input().split())
    answer = 0
    for i in range(1, limit + 1):
        if digit_sum_lower <= get_digits_sum(i) <= digit_sum_upper:
            answer += i
    print(answer)


if __name__ == '__main__':
    main()

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

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

sum = 0
for n in range(1,N+1):
    count = 0
    n_ = (str)(n)
    n_num = len(n_)
    for i in range(n_num):
        count = count + (int)(n_[i])
    if A<=count and B>=count:
        sum = sum + n
print(sum)

Solution (Python):
def solve():
    n, mi, ma = list(map(int, input().split()))
    ans = 0
    for i in range(1, n+1):
        s = sum(list(map(int, str(i))))
        if mi <= s <= ma:
            ans += i
    return ans

print(solve())

Solution (Python):
def solve():
    A = list(map(int, input().split()))

    ans = 0
    for i in range(1, A[0]+1):
        s = sum(list(map(int, str(i))))
        if A[1] <= s <= A[2]:
            ans += i
    return ans

print(solve())

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

if __name__ == '__main__':
    main()

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

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

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

number = []

def SUM(s):
  b = map(int, str(s))
  return sum(b)
  
for x in range(1, N+1):
      if A <= SUM(x) <= B:
          number.append(int(x))
     
print(sum(number))

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

Solution (Python):

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

ans = 0

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

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

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

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

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N + 1):
  sum = 0
  for s in str(i):
    sum += int(s)
  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):
    s=sum([int(j) for j in str(i)])
    if a<=s<=b:
        ans+=i

print(ans)

Solution (Python):
l = list(map(int, input().split()))
n, a, b = l[0], l[1], l[2]
total, ans = 0, 0

for i in range(n+1):
    s = list(str(i))
    for j in s:
        total += int(j)
    if a<=total  and b>=total:
        ans += i
    total = 0
print(ans)

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

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

s = 0
for i in range(1, N+1):
    if(lambda x,a,b: x>=a and x<=b)(sum([int(d) for d in str(i)]), A, B):
        s = s + i

print(s)

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

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

def tasu(i):
  k=0
  s=0
  while 10**k<i:
    k+=1
  for a in range(k+1)[::-1]:
    s+=i//(10**a)
    i-=10**a*(i//(10**a))
  return(s)
    

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

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_digit(num):
    sums = 0
    while num != 0:
        sums += num % 10
        num //= 10
    return sums

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

Solution (Python):
import math

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

total = 0
ans = []


def findSumdigit(n):
    s = str(n)
    
    array = list(map(int,s))
    return sum(array)

for i in range(A,N+1):
    total = findSumdigit(i)
    if total>= A and total <= B :
        ans.append(i)

print(sum(ans))

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

lisN=list(range(1,N+1))
lisW=[0]*N

for i in lisN:
	dignum=numpy.array(list(str(i)),dtype=int)
	lisW[i-1]=sum(dignum)

arN=numpy.array(lisN)
arW=numpy.array(lisW)
ans=sum(arN[(A<=arW)&(arW<=B)])
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):
input = input().split()
N = int(input[0])
A = int(input[1])
B = int(input[2])

ans = 0

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

    if A <= s and s <= B:
        ans += i

print(ans)

Solution (Python):
def FindSumOfDigits(n):
    Sum=0
    len_n=len(str(n))
    for i in range(len_n):
        Sum+=int(n%10)
        n=n/10
    return Sum

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


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

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

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

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


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

Solution (Python):
N,A,B=map(int,input().split())
Z=[]
for n in range(1,N+1):
    ns=str(n)
    len_ns=len(ns)
    total=0
    for x in range(len_ns):
        total=total+int(ns[x])
    if A<=total<=B:
        Z.append(n)
print(sum(Z))

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

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

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

cnt = 0

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

print(cnt)

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

cnt = 0

for n in range(1,N+1):
  temp = 0
  temp += n%10
  temp += int(n/10)%10
  temp += int(n/10/10)%10
  temp += int(n/10/10/10)%10
  temp += int(n/10/10/10/10)%10
  if temp >= A and temp <= B:
    cnt += n

print(cnt)

Solution (Python):




def main():
    N, A, B = map(int, input().split())
    result = 0
    for n in range(N + 1):
        if A <= sum([int(i) for i in list(str(n))]) <= B:
            result += n
    print(result)


if __name__ == "__main__":
    main()

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

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

Solution (Python):

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




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

ans = 0

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

print(ans)

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

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

Solution (Python):
def digitsum(n):
    if n<10:
        return n
    else:
        m=n//10
        return n%10+digitsum(m)

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

s=0

for i in range(0,N+1):
    if B>=digitsum(i)>=A:
        s=s+i

print(s)

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(n+1):
    j = str(i)
    total = 0
    for k in j:
        total += int(k)
    if a <= total <= b:
        ans += i
print(ans)

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


def wa(x):
	res = [0,0,0,0,0]
	q = x // 10**4
	if q!=0:
		x = x - 10**4 *q
		res[0]=q
	q = x // 10**3
	if q!=0:
		x = x - 10**3 *q
		res[1]=q
	q = x // 10 **2
	if q!=0:
		x = x - 10**2 *q
		res[2]=q
	q = x // 10 
	if q!=0:
		x=x - 10*q
		res[3]=q
	res[4]=x
	return sum(res)
ans=0
for nn in range(1,n+1):
	wa1 =wa(nn)
	if wa1 >= a:
		if wa1 <= b:
			ans += nn
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):
def main(n,a,b):
    res = 0
    for i in range(1, n+1):
        val = sub(i)
        if a <= val and val <= b:
            res += i
    return res

def sub(val):
    res = 0
    x = val
    while x > 0:
        x, j = divmod(x,10)
        res += j
    return res

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

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

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

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

total = 0
for i in range(1, N+1):
  SUM = numOfSumDigit(i)

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

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

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

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

print(ans)

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

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

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

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

print(str(ans))

Solution (Python):
"""
1以上N以下の整数の内、各桁の和がA以上B以下であるものの全ての総和は？

20 以下の整数のうち、各桁の和が 2 以上 5 以下なのは、
2, 3, 4, 5, 11, 12, 13, 14, 20 です。これらの合計である 84 を出力します。
"""

def summaker(n):
  sum1 = 0
  while n > 0:
    
    sum1 += n % 10
    n = n // 10
  return sum1

N, A, B = map(int, input().strip().split(' '))
total = 0
for i in range(1, N + 1):
  sum1 = summaker(i)
  if A <= sum1 <= B:
    total += i

print(total)

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

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

print(ans)

Solution (Python):
n,a,b=map(int,input().split(" "))
def check(x):
    sum=0
    while x>0: 
        sum = sum + x % 10 
        x=int(x/10); 
    return sum
 
total=0
for i in range(n+1): 
    sum=check(i)
    if sum<=b and sum>=a:
        
        total=total+i

print(total)

Solution (Python):
n,a,b=map(int,input().split(" "))
def check(x):
    sum=0
    while x>0: 
        sum = sum + x % 10 
        x=int(x/10); 
    return sum

total=0
for i in range(n+1): 
    sum=check(i)
    if sum<=b and sum>=a:
        
        total=total+i

print(total)

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

ans=0

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

print(ans)

Solution (Python):

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

def FindSumOfDigits(x):
    count = 0
    while x>0:
        count += x%10
        x = x//10
    
    return count
    

for n in range(1, N+1):
    count = FindSumOfDigits(n)
    if A<= count <=B:
        ans += n

print(ans)

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

for n in range(1, N+1):
    count = 0
    n_list = n
    while True:
        count += n%10
        n = n//10
        if n==0:
            break

    if A<= count <=B:
        l.append(n_list)

for i in l:
    ans += i

print(ans)

Solution (Python):

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

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

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

sum = 0

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

print(sum)

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

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

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


def main():
    N, A, B = map(int, input().split())
    ans = 0

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
"""
1以上N以下の整数の内、各桁の輪がA以上B以下であるものの全ての総和は？

20 以下の整数のうち、各桁の和が 2 以上 5 以下なのは、
2, 3, 4, 5, 11, 12, 13, 14, 20 です。これらの合計である 84 を出力します。
"""

N, A, B = map(int, input().strip().split(' '))
sum_list = []
for i in range(1, N + 1):
  
  if len(str(i)) == 1:
    if A <= i <= B:
      sum_list.append(i)
  elif len(str(i)) == 2:
    if A <= int(str(i)[0]) + int(str(i)[1]) <= B:
      sum_list.append(i)
  elif len(str(i)) == 3:
    if A <= int(str(i)[0]) + int(str(i)[1]) + int(str(i)[2]) <= B:
      sum_list.append(i)
  elif len(str(i)) == 4:
    if A <= int(str(i)[0]) + int(str(i)[1]) + int(str(i)[2]) + int(str(i)[3]) <= B:
      sum_list.append(i)
  else:
    if A <= int(str(i)[0]) + int(str(i)[1]) + int(str(i)[2]) + int(str(i)[3]) + int(str(i)[4]) <= B:
      sum_list.append(i)
print(sum(sum_list))

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

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

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

for i in range(n+1):
    add = 0
    add = SumOfDigits(i)
    if a <= add and add <= b:
        sum += i

print(sum)

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

for i in range(N+1):
  output=0
  c=i
  for p in range(4,-1,-1):
    order=int(c/10**p)
    c=c-order*10**p
    output+=order
  if output>=A and output<=B:
    
    SUM+=i
    
print(SUM)

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

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

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

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

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

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

for i in range(n+1):
    add = 0
    add = SumOfDigits(i)
    if a <= add and add <= b:
        sum += i

print(sum)

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

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

ans = []
for n in range(1, n_num+1):
  n_str = list(str(n))
  total = sum(list(map(int, n_str)))
  if total >= a and total <= b:
    ans.append(n)

print(sum(ans))

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

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

print(cnt)

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

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

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

print(sum(arr))

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

sums=0

def digits_sum(digits,len):
    sum=0
    for i in range(len):
        sum+=int(digits[i])
    return sum


for i in range(N+1):
    digits=str(i)
    sum=digits_sum(digits,len(digits))
    if sum>=A and sum<=B:
        sums+=i
    else:
        pass

print(sums)

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,a,b=INTM()
    ans=0
    for i in range(1,n+1):
        ct=0
        si=str(i)
        for j in si:
            ct+=int(j)
        if a<=ct and ct<=b:
            ans+=i
            
    print(ans)
if __name__ == '__main__':
    do()

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

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

for i in range(1, n+1):
  q = i // 10000
  qi = i % 10000
  w = qi // 1000
  wi = qi % 1000
  e = wi // 100
  ei = wi % 100
  r = ei // 10
  ri = ei % 10
  t = ri
  sum = q + w + e + r + t
  if sum >= a and sum <= b:
    x += i
    
print(x)

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

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

def digitsum(j):
    s = str(j)
    array = list(map(int, s))
    return sum(array)

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

Solution (Python):
from functools import reduce 
from operator import add
n, a, b = map(int, input().split())

n_cond = 0

for i in range(1, n+1):
  i_str = str(i)

  if len(i_str) == 1:
    order_sum = i
    
  else:
    temp = list(map(int, i_str))
    order_sum = reduce(add, temp)
    
  if order_sum >= a and order_sum <= b:
    n_cond += i
print(n_cond)

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

total = 0

def sum_digits(n):
  return sum(map(int, str(n)))

for n in range(1, N + 1):
  if A <= sum_digits(n) <= B:
    total += n
    
print(total)

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

ans = 0
for num in range(1, n+1):
    str_num = str(num)

    sum = 0
    for s in str_num:
        sum += int(s)

    if a <= sum <= b:
        ans += num

print(ans)

Solution (Python):
n,a,b=map(int, input().split())
r=0
for x in range(1,n+1):
    p=str(x)
    l=len(p)
    s=0
    for y in range(l):
       s=s+int(p[y]) 
    if s>=a and s<=b:
        r+=x
print(r)