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):
def calc_sum_digits(n):
    return sum(int(x) for x in str(n))

N, A, B = map(int, input().split())
print(sum(n if A <= calc_sum_digits(n) <= B else 0 for n in range(1, N+1)))

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

N, A, B = map(int, input().split())
result = 0
for n in range(1, N+1):
    sumdigit = calc_sum_digits(n)
    if sumdigit >= A and sumdigit <= B:
        result += n
print(result)

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

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

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

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

print(ans)

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

Solution (Python):
n,a,b=map(int,input().split())
def func(x):
    count=0
    while True:
        count+=x%10
        x//=10
        if x==0:
            break
    return count
ans=0
for i in range(n+1):
    if func(i)>=a and func(i)<=b:
        ans+=i
print(ans)

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

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

Solution (Python):
N,A,B = input().split()
N,A,B = map(int,(N,A,B))
f=0
for i in range(1,N+1):
  k=i
  a = i//10000
  i = i-a*10000
  b = i//1000
  i = i-b*1000
  c = i//100
  i = i-c*100
  d = i//10
  i = i-d*10
  e = i
  s = a+b+c+d+e
  if A<=s<=B:
    f += k
print(f)

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

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

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


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

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 and s <= B: ans += n
    
print(ans)

Solution (Python):


nab = [int(s) for s in input().split()]

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

count = 0
for i in range(N):
  target = str(i+1)
  total = 0
  for j in range(len(target)):
    total = total + int(target[j])

  if total >= A and total <= B:
    count = count + int(target)

print(count)

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

resultNum = 0

for i in range(int(x)+1):
  loopCnt = len(str(i))
  addNum = 0
  for j in range(loopCnt):
    addNum += int(str(i)[j])
  if int(y) <= addNum <= int(z):
    resultNum += i

print(resultNum)

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

count=0

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

print(count)

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

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

print(ans)

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

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

sum = 0
for n in range(1,N + 1):
  d5, mod = divmod(n,10**4)
  d4, mod = divmod(mod,10**3)
  d3, mod = divmod(mod,10**2)
  d2, mod = divmod(mod,10)
  d1 = mod
  s = d1 + d2 + d3 + d4 + d5
  if A <= s <= B:
    sum += n

print(sum)

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

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

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

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

print(result)

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

N, A, B = map(int, input().split())
result = 0
for n in range(1, N+1):
    sum = calc_sum_digits(n)
    if sum >= A and sum <= B:
        result += n
print(result)

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

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

Solution (Python):
n,a,b = map(int,input().split())
c = 0
for i in range(1,n+1):
    if i < 10:
        x = str(i)
        xsum = int(x[0])
        if xsum >= a and xsum <= b:
            c += i
    elif i < 100:
        x = str(i)
        xsum = int(x[0]) + int(x[1])
        if xsum >= a and xsum <= b:
            c += i
    elif i < 1000:
        x = str(i)
        xsum = int(x[0]) + int(x[1]) + int(x[2])
        if xsum >= a and xsum <= b:
            c += i
    elif i < 10000:
        x = str(i)
        xsum = int(x[0]) + int(x[1]) + int(x[2]) + int(x[3])
        if xsum >= a and xsum <= b:
            c += i
    else:
        x = str(i)
        xsum = int(x[0]) + int(x[1]) + int(x[2]) + int(x[3]) + int(x[4])
        if xsum >= a and xsum <= b:
            c += i
print(c)

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())
t = 0
for i in range(N):
    s =0
    n = i+1
    while n > 0:
        s += n%10
        n = int(n/10)
    if (s >= A)and(s <= B):
        t += (i+1)
print(t)

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

sum_numbers = 0

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

Solution (Python):

abN=input("")
nab=abN.split(" ")
rn=int(nab[0])
ra=int(nab[1])
rb=int(nab[2])
p=[int(s+1) for s in range(rn)]
def counting(s):
    if s<10:
        if ra<=s<=rb:
            return s
    if 10<=s<100:
        s=str(s)
        w10=int(s[0:1])
        w1=int(s[1:2])
        s=int(s)
        ww=w10+w1
        if ra<=ww<=rb:
            return s
    if 100<=s<1000:
        s=str(s)
        w100=int(s[0:1])
        w10=int(s[1:2])
        w1=int(s[2:3])
        s=int(s)
        ww=w100+w10+w1
        if ra<=ww<=rb:
            return s
    if 1000<=s<10000:
        s=str(s)
        w1000=int(s[0:1])
        w100=int(s[1:2])
        w10=int(s[2:3])
        w1=int(s[3:4])
        s=int(s)
        ww=w1000+w100+w10+w1
        if ra<=ww<=rb:
            return s
    if 10000==s:
        if ra<=1<=rb:
            return s
    else:
        return 0
r=map(counting,p)
g=list(r)
print(sum(g))

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

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

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

ans = 0
for n in range(1, N + 1):
    m = n
    sum = 0
    while m > 0:
        sum += m % 10
        m //= 10
    if A <= sum <= B:
        ans += n

print(ans)

Solution (Python):
import numpy as np
                                                               
def ketawa(x):
    return sum(list(map(int, str(x))))
                                                               
N, A, B = map(int, input().split())
new_func = np.frompyfunc(ketawa, 1, 1)
arr = np.arange(1, N + 1)
result = new_func(arr)
print(np.sum(np.where((A <= result) & (result <= B), arr, 0)))

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

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

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

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

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

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

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

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

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

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

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

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

print(sum)

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

ans = 0
for i in range(1,N+1):
    a = int(i/10000)%10
    b = int(i/1000)%10
    c = int(i/100)%10
    d = int(i/10)%10
    e = i%10
    
    if A<=a+b+c+d+e and a+b+c+d+e<=B:
        ans += i
        
print(ans)

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

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

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

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

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

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_list=[]

for i in range(1,n+1):
    num=i
    re=0
    while num>0:
        re+=num%10
        num//=10
    if a<=re<=b:
        ans_list.append(i)

print(sum(ans_list))

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

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

r_sum = 0
for i in range(1, N+1):
  sum_digit = 0
  n_str = str(i)
  for j in range(len(n_str)):
    sum_digit += int(n_str[j])
  if A <= sum_digit and sum_digit <= B:
    r_sum += i
print(str(r_sum))

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

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

print(ans)

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

Solution (Python):
N, A, B= list(map(int, input().split()))
ans = 0
digsum = 0
for i in range(1,N+1):
  if i<10:
    digsum = i
  elif i <100:
    dig1 = i%10
    dig2 = ((i%100)-dig1)/10
    digsum = dig1 + dig2
  elif i < 1000:
    dig1 = (i%10)
    dig2 = ((i%100)-dig1)/10
    dig3 = i//100
    digsum = dig1 + dig2 + dig3
  elif i < 10000:
    dig1 = (i%10)
    dig2 = ((i%100)-dig1)/10
    dig3 = ((i%1000) - dig2*10 - dig1)/100
    dig4 = i//1000
    digsum = dig1 + dig2 + dig3 + dig4
  else:
    digsum = 1
  if (digsum>=A) and (digsum<=B):
    ans += i
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
    s = str(i)
    su = 0
    for j in range(len(s)):
        su += int(s[j])
    if a <= su and su <= 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([int(i) for i in str(i)]) <= b:
        ans += i
else:
    print(ans)

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

sum = 0
for i in range(n+1):
    digitSum = 0
    digitCheck = i
    while digitCheck>0:
        digitSum += digitCheck%10
        digitCheck = digitCheck//10
    if a <= digitSum <= b:
        sum +=i
    
    
print(sum)

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

Solution (Python):

n, a, b = [int(x) for x in input().split()]
total = 0

def digit_sum(num,digitotal = 0):
      while(num > 0):
            digitotal += num%10
            num //= 10
      return digitotal
      
for i in range(1,n+1):
      x = digit_sum(i)
      if x >= a and x <= b:
            
            total += i

print(total)

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

Solution (Python):
def digit_sum(x): 
    y = str(x) 
    y_len = len(y) 
    ans = 0
    for j in range(y_len):
        ans += int(y[j]) 

    return ans

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

print(answer)

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

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

print(ans)

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

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

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

total=0
for n in range(1,N+1):
    if A<=sum_keta(n)<=B:
        total+=n
    else:
        continue

print(total)

Solution (Python):
from functools import reduce

n,a,b = map(lambda x:int(x),input().split(" "))

ans = 0
for ni in range(a,n+1):
    add_each_dig = int(reduce(lambda x, y: int(x) + int(y), str(ni) ))
    if a <= add_each_dig and add_each_dig <= b:
        ans += ni

print(ans)

Solution (Python):
from functools import reduce

n,a,b = map(lambda x:int(x),input().split(" "))

ans = 0
for ni in range(a,n+1):
    if ni <= 9 :
        if a <= ni and ni <= b:
            ans += ni
    else:
        add_each_dig = reduce(lambda x, y: int(x) + int(y), str(ni) )
        if a <= add_each_dig and add_each_dig <= b:
            ans += ni

print(ans)

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

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

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

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

    return sum

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

print(total)

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

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

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

print(total)

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

Solution (Python):
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

Solution (Python):




def resolve():
    import sys
    input = sys.stdin.readline

    n, a, b = [int(x) for x in input().rstrip().split(" ")]
    ans = 0
    for i in range(1, n+1):
        x = sum([int(c) for c in str(i)])
        if x >= a and x <= b:
            ans += i

    print(ans)


if __name__ == "__main__":
    resolve()

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

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

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

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

Solution (Python):



def main():
    args = input().split()
    N = int(args[0])
    A = int(args[1])
    B = int(args[2])

    counter = 0
    for i in range(1, N + 1):
        sumValue = sum(list(map(lambda x: int(x), list(str(i)))))
        if sumValue >= A and sumValue <= B:
            counter += i

    print(counter)


if __name__ == "__main__":
    main()

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

def some_sum(n):
    n = str(n)
    n = list(n)
    n = [int(j) for j in n]
    return sum(n)
    
count = 0
for k in range(A,N+1):
    if A <= some_sum(k) <= B:
        count += k
print(count)

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

while n <= N:
    result_n = sum(list(map(int, str(n))))
    if A <= result_n <= B:
        cnt = cnt+n
    n += 1

print(cnt)

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

count = 0

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

print(count)

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

ans = 0
for i in range(1, n+1):
    s = 0
    for j in range(5):
        m = 10**j
        s += (i // m) % 10
    if a <= s <= b:
        ans += i
print(ans)

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

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

ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
    else:
        continue
print(ans1)

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

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

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

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

ans =0

while N > 0:
    n = N
    t = 0

    while n > 0:
        t += n % 10
        n //= 10

    if A <= t <= B:
        ans += N

    N -= 1

print(ans)

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

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

sum = 0

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

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

ans = 0
for i in range(N+1):
    moji = str(i)
    n = 0
    for j in range(len(moji)):
      n += int(moji[j])

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

print(ans)

Solution (Python):

N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
    moji = str(str(i).zfill(4))
    sumsomes = int(moji[0])+int(moji[1])+int(moji[2])+int(moji[3])
    if (sumsomes >= A) and (sumsomes <= B):
        ans += i
print(ans)

Solution (Python):
def calc(num, A, B) -> bool:
	ans = 0

	while True:
		if num // 10 == 0:
			ans += num
			break
		ans += num % 10
		num //= 10

	if A <= ans and ans <= B:
		return True
	else:
		return False



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

	for num in range(1, N + 1):
		result = calc(num, A, B)
		if result:
			ans += num

	print(ans)

  
if __name__ == "__main__":
  	main()

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

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

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

for i in range(1,n+1):
    i = str(i)
    List = []
    for j in range(len(i)):
        List.append(i[j])
    List = list(map(int,List))
    
    if sum(List) >= a and sum(List) <= b:
        count += int(i)

print(str(count))

Solution (Python):

n, a, b = (int(x) for x in input().split())

ans = 0


for i in range(n + 1):
    
    

    _sum = 0

    
    for j in range(len(str(i))):

        

        _sum = _sum + int(str(i)[j])

        if b < _sum :
            break

    

    if a <= _sum and _sum <= b :
        ans = 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 = list(map(int, input().split()))
array = []
array2 = []

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

for i in range(1,n+1):
  if degitSum(i) >= a and degitSum(i) <= b:
    array2.append(i)
    
print(sum(array2))

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

Solution (Python):
upNum, firstNum, lastNum = map(int, input().split())
total = 0
digitNumSum = 0
for i in range(1, upNum + 1):
  digitNumSum = 0
  digitNumList = list(str(i))
  for j in range(len(digitNumList)):
    digitNumSum += int(digitNumList[j])
  if firstNum <= digitNumSum <= lastNum:
    total += i
print(total)

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

Solution (Python):









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

def func(s):
    rtn = 0
    for i in s:
        rtn += int(i)
    return rtn

ans = [0]
for i in range(1,n+1):
    temp = func(str(i))
    if (temp >= a and temp <= b):
        ans.append(i)

print(sum(ans))

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

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

print(ans)

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

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

Solution (Python):

import math

x=1234

def divmod2(x,y):
    a=math.floor(x/y)
    b=x%y
    return x,y

def ksouwa(x):
    x=int(x)
    sen=math.floor(x/1000)
    hyaku=math.floor((x%1000)/100)
    juu=math.floor((x%100)/10)
    iti=math.floor(x%10)
    return sen+hyaku+juu+iti

def ksouwa2(x):
    int1=0
    x=str(x)
    len(x)
    for i in list(x):
        
        int1=int(int1)+int(i)
    return int1

X,A,B=open(0).read().split()

X=int(X)

A=int(A)

B=int(B)

int1=0
int2=0

for i in range(X+1):
    if (ksouwa2(i)>=A) and (ksouwa2(i)<=B):
        int1=int1+1
        int2=int2+i


print(int2)

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

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

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

ans = 0

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

print(ans)

Solution (Python):
N,A,B = map(int,input().split())
a=0
b=0
c=0
d=0
e=0
y=0
for i in range(1,N+1,1):
  n = str(i)
 
  if int(n)==10000:
    e=n[0]
    d=n[1]
    c=n[2]
    b=n[3]
    a=n[4]
  if 1000<=int(n)<10000:
    d=n[0]
    c=n[1]
    b=n[2]
    a=n[3]
  if 100<=int(n)<1000:
    c=n[0]
    b=n[1]
    a=n[2]
  if 10<=int(n)<100:
    b=n[0]
    a=n[1]
  if int(n)<10:
    a=n[0]
  x = int(d) + int(c) + int(b) + int(a) + int(e)
  if A <= x <= B:
    y = y + int(n)
print(y)

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

Solution (Python):
def int_sum(x):
    y=str(x)
    num=0
    for i in range(len(y)):
        num += x%10
        x = x//10
    return num

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

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

def int_to_sum(i):
    i_str = str(i)
    result = 0
    for i_s in i_str:
        result += int(i_s)
    return result

result = 0

for i in range(1,N+1):
    int_sum = int_to_sum(i)
    if int_sum <= B and int_sum >= A:
        result += i

print(result)

Solution (Python):
def digitsum(s):
  s = str(s)
  a = 0
  for i in range(len(s)):
    a += int(s[i])
  return a

N, A, B = list(map(lambda x: int(x), input().split(" ")))

print(sum([j for j in range(N + 1) if A <= digitsum(j) <= B]))

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

for i in range(n+1):
    s_sum = 0
    c = i
    while c>0:
        s_sum += c%10
        c = c//10
    if a <= s_sum <= b:
        sum += i
print(sum)

Solution (Python):
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, a, b =  inintm()

ans = 0

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

print(ans)

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

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

def sum_of_num(num):
    list_a = []
    sums = 0
    while num > 0:
        list_a.append(num % 10)
        num = num // 10
    for i in range(len(list_a)):
        sums = sums + list_a[i]
    return sums

list_b = []
for i in range(1,N+1):
    if A <= sum_of_num(i) <=B:
        list_b.append(i)

sums = 0
for i in range(len(list_b)):
    sums = sums + list_b[i]

print(str(sums))

Solution (Python):
a, b, c = map(int, input().split())
start_number = 0
sum_number = 0
for d in range(0, a+1, 1):
    for e in str(d):
        sum_number += int(e)
    if b <= sum_number <= c:
        start_number += d
        sum_number = 0
    else:
        sum_number = 0
print(start_number)

Solution (Python):
def kakuinowa(x):
    y=0
    for i in range(5):
        y+=(x%(10**(i+1)))//(10**i)
    return(y)
n,a,b = list(map(int, input().strip().split()))
ans=0
for i in range(n+1):
    if a<=kakuinowa(i) and kakuinowa(i)<=b:
        ans+=i
print(ans)

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

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

ans = 0

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

print(ans)

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

def digisum(m):
  if m<10:
    return m
  else:
    return digisum(m//10)+m%10

print(sum(x for x in range(1,n+1) if a<=digisum(x)<=b))

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

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

Solution (Python):
def f(x):
    return (sum(list(map(int, list(str(x))))))

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

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

ans = 0
for i in range(1, N + 1):
    total = 0
    buf = i
    for j in range(4, -1, -1):
        division, buf = divmod(buf, 10**j)
        total += division
    if total >= A:
        if total <= B:
            ans += i
print(ans)

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