stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

#define R(X) cin>>X



using namespace std;

inline int digitSum(int num){

	int out=0;

	while(num!=0){

		out+=num%10;

		num/=10;

	}

	return out;

}

int main(){

	int N;R(N);

	int a,b;R(a);R(b);

	int sum=0;

	for(int i=1;i<=N;i++)

	    if(digitSum(i)<=b&&digitSum(i)>=a)

		    sum+=i;

	cout<<sum;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.245783445721279x):
#include <stdio.h>



int main () {

	int ans = 0;

	int N, A, B;

	scanf ("%d %d %d", &N, &A, &B);

	for (int i = 0; i <= N; i++) {

		int digit = 0;

		int aa = i;

		while (aa != 0) {

			digit = digit + aa % 10;

			aa /= 10;

		}

		

		if (digit >= A && digit <= B) {

			ans += i;

		}

//		if (i == 10 || i == 100 || i == 1000 || i == 10000) {

//			if (1 >= A && 1 <= B) {

//				ans += i;	

//			}

//		} else if (i < 10) {

//			if (i >= A && i <= B) {

//				ans += i;

//				}

//		} else if (i > 10 && i < 100) {

//			int Bb = i / 10;

//			int Bbb = i - (Bb*10);

//			int B1 = Bb + Bbb;

//			if (B1 >= A && B1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 100 && i < 1000) {

//			int Cc = i / 100;

//			int Ccc = (i - (Cc*100)) / 10;

//			int Cccc = i - (Cc * 100) - (Ccc * 10);

//			int C1 = Cc + Ccc + Cccc;

//			if (C1 >= A && C1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 1000 && i < 10000) {

//			int D = i / 1000;

//			int Dd = (i - (D*100)) / 100;

//			int Ddd = (i - (D * 1000) - (Dd * 100) / 10);

//			int Dddd = i - (D * 1000) - (Dd * 100) - (Ddd * 10);

//			int D1 = D + Dd + Ddd + Dddd;

//			if (D1 >= A && D1 <= B) {

//				ans += i;

//			}

//		}

	}

	printf ("%d", ans);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <string>

using namespace std;

int n;

int a,b;



int main() {

    cin>>n>>a>>b;

    int answer=0;

    for(int i=0;i<=n;i++)

    {

        string temp= to_string(i);

        int count=0;

        for(int t=0;t<temp.length();t++)

        {

            count+=temp[t]-'0';

        }

        if(count>=a&&count<=b)

        answer+=i;

    }

    cout<<answer;

}


// Faster C++ solution for the same problem (measured speedup: 5.29909909175884x):
#include <stdio.h>



int main () {

	int ans = 0;

	int N, A, B;

	scanf ("%d %d %d", &N, &A, &B);

	for (int i = 0; i <= N; i++) {

		int digit = 0;

		int aa = i;

		while (aa != 0) {

			digit = digit + aa % 10;

			aa /= 10;

		}

		

		if (digit >= A && digit <= B) {

			ans += i;

		}

//		if (i == 10 || i == 100 || i == 1000 || i == 10000) {

//			if (1 >= A && 1 <= B) {

//				ans += i;	

//			}

//		} else if (i < 10) {

//			if (i >= A && i <= B) {

//				ans += i;

//				}

//		} else if (i > 10 && i < 100) {

//			int Bb = i / 10;

//			int Bbb = i - (Bb*10);

//			int B1 = Bb + Bbb;

//			if (B1 >= A && B1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 100 && i < 1000) {

//			int Cc = i / 100;

//			int Ccc = (i - (Cc*100)) / 10;

//			int Cccc = i - (Cc * 100) - (Ccc * 10);

//			int C1 = Cc + Ccc + Cccc;

//			if (C1 >= A && C1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 1000 && i < 10000) {

//			int D = i / 1000;

//			int Dd = (i - (D*100)) / 100;

//			int Ddd = (i - (D * 1000) - (Dd * 100) / 10);

//			int Dddd = i - (D * 1000) - (Dd * 100) - (Ddd * 10);

//			int D1 = D + Dd + Ddd + Dddd;

//			if (D1 >= A && D1 <= B) {

//				ans += i;

//			}

//		}

	}

	printf ("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cmath>

#include<string>

using namespace std;



int sum(int x)

{

  int b=10,s=0,i,q,ar[5],y;

  ar[0]=0;

  q=log10(x);

  if(q==log10(x))

  {

      y=log10(x)+1;

  }

  else

  {

     y=ceil(log10(x));

  }

  for(i=1;i<=y;i++)

  {

      ar[i]=((x%b)-ar[i-1])/(b/10);

      s=s+ar[i];

      b=b*10;

  }

  return s;

}



int main()

{

   int a,b,n,s=0,i;

   cin >> n >> a >> b;

   for(i=1;i<=n;i++)

   {

       if(sum(i)>=a&&sum(i)<=b)

       {

           s=s+i;

       }



   }

   cout << s;

   return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.275622629766905x):
#include<stdio.h>



int main(){

	int n, a, b;

	scanf("%d %d %d", &n, &a, &b);

	int sum = 0;

	for(int i = 1; i <= n; i++){

		int numSum = 0;

		int temp = i;

		while(temp > 0){

			numSum = numSum + (temp % 10);

			temp = temp / 10;

		}

		if(numSum >= a && numSum <= b){

			sum += i;

		}

	}

	printf("%d", sum);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define ll long long

using namespace std;



bool sumofdigit(int x, int a, int b){

    int s=0;

    while(x){



    s+=x%10;

    x/=10;

    }

    if(s>=a && s<=b){

        return true;

    }

    else{

        return false;

    }

}





int main()

{

    ll int jogfol=0;

    int n,a,b;

    cin>>n>>a>>b;



    for(int i=1; i<=n; i++){

        if(sumofdigit(i,a,b)){

            jogfol+=i;

        }

    }

    cout<<jogfol;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.229722224679572x):
#include<stdio.h>



int main(){

	int n, a, b;

	scanf("%d %d %d", &n, &a, &b);

	int sum = 0;

	for(int i = 1; i <= n; i++){

		int numSum = 0;

		int temp = i;

		while(temp > 0){

			numSum = numSum + (temp % 10);

			temp = temp / 10;

		}

		if(numSum >= a && numSum <= b){

			sum += i;

		}

	}

	printf("%d", sum);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <cmath>

#include <bitset>

#include <cstring>

#include <string.h>

#include <sstream>

#include <iomanip>

#include <queue>

#include <stack>

#include <deque>

#include <map>

#include <set>

#include <unordered_set>

#include <unordered_map>

#include <vector>

#include <stdio.h>

#include <stdlib.h>

using namespace std;

 

typedef unsigned long ul;

typedef unsigned long long ull;

typedef long long ll;

typedef pair<int,int> pii;

typedef pair<ll,ll> pll;

 

const ll MOD = 1e9+7;

const double PI  = 3.14159265358;

const double EPS = 1e-8;



#define INT_MX 2147483647

#define INF ((int)1e9)

#define LLINF ((ll)1e18)

#define F first

#define S second

#define mp(x,y) make_pair(x,y)

#define sz(v) ((int)v.size())

#define rs(n) resize(n)

#define all(v) v.begin(),v.end()

#define reset(v) memset((v),0,sizeof(v))

#define EB emplace_back

#define pb push_back

#define pf push_front

#define rep(i,n) for(int i=0;i<(n);i++)

#define rep1(i,n) for(int i=1;i<=(n);i++)

#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);





void solve(){

    int n, a, b, ct;

    ll ans;

    string s;

    

    ans = 0;

    

    cin >> n >> a >> b;

    rep1(i, n){

        s = to_string(i);

        ct = 0;

        for(auto i:s)

            ct += i - '0';

        if(ct >= a && ct <= b)

            ans += i;

    }

    cout << ans << '\n';

}



int main(){

    

    solve();

}








// Faster C++ solution for the same problem (measured speedup: 5.332434120602952x):
#include<stdio.h>



int main(){

	int n, a, b;

	scanf("%d %d %d", &n, &a, &b);

	int sum = 0;

	for(int i = 1; i <= n; i++){

		int numSum = 0;

		int temp = i;

		while(temp > 0){

			numSum = numSum + (temp % 10);

			temp = temp / 10;

		}

		if(numSum >= a && numSum <= b){

			sum += i;

		}

	}

	printf("%d", sum);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define AC ios_base::sync_with_stdio(0),cin.tie(0);

int main(void)

{

	AC;

	int T,a,n,i,b,k,t,sum=0;

	cin>>n>>a>>b;

	for(i=1;i<=n;i++){

		k=i;

		t=0;

		while(k!=0){

			t+=k%10;

			k/=10;

		}

		if(t>=a && b>=t) sum+=i;

	}

	cout<<sum<<"\n";

}




// Faster C++ solution for the same problem (measured speedup: 5.316119069986853x):
#include<stdio.h>



int main(){

	int n, a, b;

	scanf("%d %d %d", &n, &a, &b);

	int sum = 0;

	for(int i = 1; i <= n; i++){

		int numSum = 0;

		int temp = i;

		while(temp > 0){

			numSum = numSum + (temp % 10);

			temp = temp / 10;

		}

		if(numSum >= a && numSum <= b){

			sum += i;

		}

	}

	printf("%d", sum);

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;



int sums(int n){

    int re=0;

    while(n>9){

        re+=n%10;

        n/=10;

    }

    re+=n;

    return re;

}



int main(){

    int n,a,b;

    cin>>n>>a>>b;

    int sum=0;

    for(int i=1;i<=n;i++){

        if(sums(i)>=a && sums(i)<=b){

            sum+=i;

        }

    }

    cout<<sum;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.23346055669034x):
#include<stdio.h>



int main(){

	int n, a, b;

	scanf("%d %d %d", &n, &a, &b);

	int sum = 0;

	for(int i = 1; i <= n; i++){

		int numSum = 0;

		int temp = i;

		while(temp > 0){

			numSum = numSum + (temp % 10);

			temp = temp / 10;

		}

		if(numSum >= a && numSum <= b){

			sum += i;

		}

	}

	printf("%d", sum);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define R(X) cin>>X



using namespace std;

inline int digitSum(int num){

	int out=0;

	while(num!=0){

		out+=num%10;

		num/=10;

	}

	return out;

}

int main(){

	int N;R(N);

	int a,b;R(a);R(b);

	int sum=0;

	for(int i=1;i<=N;i++)

	    if(digitSum(i)<=b&&digitSum(i)>=a)

		    sum+=i;

	cout<<sum;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.233365988633566x):
#include<stdio.h>



int main(){

	int n, a, b;

	scanf("%d %d %d", &n, &a, &b);

	int sum = 0;

	for(int i = 1; i <= n; i++){

		int numSum = 0;

		int temp = i;

		while(temp > 0){

			numSum = numSum + (temp % 10);

			temp = temp / 10;

		}

		if(numSum >= a && numSum <= b){

			sum += i;

		}

	}

	printf("%d", sum);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <string>

using namespace std;

int n;

int a,b;



int main() {

    cin>>n>>a>>b;

    int answer=0;

    for(int i=0;i<=n;i++)

    {

        string temp= to_string(i);

        int count=0;

        for(int t=0;t<temp.length();t++)

        {

            count+=temp[t]-'0';

        }

        if(count>=a&&count<=b)

        answer+=i;

    }

    cout<<answer;

}


// Faster C++ solution for the same problem (measured speedup: 5.286555429547788x):
#include<stdio.h>



int main(){

	int n, a, b;

	scanf("%d %d %d", &n, &a, &b);

	int sum = 0;

	for(int i = 1; i <= n; i++){

		int numSum = 0;

		int temp = i;

		while(temp > 0){

			numSum = numSum + (temp % 10);

			temp = temp / 10;

		}

		if(numSum >= a && numSum <= b){

			sum += i;

		}

	}

	printf("%d", sum);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()



{

    int n,a,b;

    scanf("%d %d %d",&n,&a,&b);

    int i,j,x,y,s=0,hp;

    for(i=1;i<=n;i++)

    {

        x=0;

        y=i;

        for(j=0;;j++)

        {

            if(pow(10,j)>y)

            {

                hp=j-1;

                break;

            }

        }

        for(j=hp;j>=0;j--)

        {

            int power=pow(10,j);

            x=x+y/power;

            y=y%power;

        }







        if(x>=a&&x<=b)

        {

            s=s+i;

        }

    }

    printf("%d",s);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.6485929786410303x):
#include<stdio.h>

int main()

{

    int i,j,k,l,m,n,o,a,b,sum;

    scanf("%d",&n);

    scanf("%d",&a);

    scanf("%d",&b);

    sum=0;

    for(o=0;o<=9;o++)

    {

        for(i=0;i<=9;i++)

        {

            for(j=0;j<=9;j++)

            {

                for(k=0;k<=9;k++)

                {

                    for(l=0;l<=9;l++)

                    {

                        for(m=a;m<=b&&10000*o+1000*i+100*j+10*k+l<=n;m++)

                        {

                            if(m==o+i+j+k+l)

                            {

                                sum=sum+10000*o+1000*i+100*j+10*k+l;

                                break;

                            }

                        }

                    }

                }

            }

        }

    }

    printf("%d",sum);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main ()



{

    int a,c,N,A,B,i,x,y,z,k,j;

    j=0;

    scanf("%d%d%d",&N,&A,&B);

    c=N;

    for(i=1;i<=c;i++){

        N=i;

        x=N/10000.0;

        N=N-10000*x;

        y=N/1000.0;

        N=N-1000*y;

        z=N/100.0;

        N=N-z*100;

        a=N/10.0;

        N=N-a*10;



        k=a+z+x+y+N;

        if(k>=A && k<=B){

            j=i+j;

        }





    }

    printf("%d",j);

}


// Faster C++ solution for the same problem (measured speedup: 2.6320340345995508x):
#include<stdio.h>

int main()

{

    int i,j,k,l,m,n,o,a,b,sum;

    scanf("%d",&n);

    scanf("%d",&a);

    scanf("%d",&b);

    sum=0;

    for(o=0;o<=9;o++)

    {

        for(i=0;i<=9;i++)

        {

            for(j=0;j<=9;j++)

            {

                for(k=0;k<=9;k++)

                {

                    for(l=0;l<=9;l++)

                    {

                        for(m=a;m<=b&&10000*o+1000*i+100*j+10*k+l<=n;m++)

                        {

                            if(m==o+i+j+k+l)

                            {

                                sum=sum+10000*o+1000*i+100*j+10*k+l;

                                break;

                            }

                        }

                    }

                }

            }

        }

    }

    printf("%d",sum);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define pb push_back

#define rep(i,n) for(int i=0;i<n;i++)

#define rep1(i,n) for(int i=1;i<=n;i++)

#define mp make_pair

#define F first

#define S second

#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

typedef long long ll;

vector<int> g[100005];

ll q,n;



int main()

{

    //IOS;

    while(cin>>n)

    {

        ll sum=0;

        ll A,B;

        cin>>A>>B;

        for(int i=1;i<=n;i++)

        {

            ll a=i/10000,b=(i%10000)/1000,c=(i%1000)/100,d=(i%100)/10,e=i%10;

            if(a+b+c+d+e<=B&&a+b+c+d+e>=A) sum+=i;

        }

        cout<<sum<<"\n";

    }



    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 3.5382612219856817x):
#include<bits/stdc++.h>



using namespace std;



int main(){

    int n,a,b,ans=0,d,p=0;

    cin >> n >> a >> b;

    for(int t=1;t<=n;t++){

        d=t,p=0;

        while(d>=1){

            p+=d%10;

            d/=10;

        }

        if(p>=a && p<=b){

            ans+=t;

        }

    }

    cout << ans << '\n';

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()



{

    int n,a,b;

    scanf("%d %d %d",&n,&a,&b);

    int i,j,x,y,s=0,hp;

    for(i=1;i<=n;i++)

    {

        x=0;

        y=i;

        for(j=0;;j++)

        {

            if(pow(10,j)>y)

            {

                hp=j-1;

                break;

            }

        }

        for(j=hp;j>=0;j--)

        {

            int power=pow(10,j);

            x=x+y/power;

            y=y%power;

        }







        if(x>=a&&x<=b)

        {

            s=s+i;

        }

    }

    printf("%d",s);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.203584736063426x):
#include <stdio.h>

#include <string.h>



#define INT_MAX 2147483647

#define INT_MIN -2147483648



int max(int a, int b);

int min(int a, int b);

int abs(int a);



int n, a, b;



int main() {

	scanf("%d %d %d", &n, &a, &b);

	int total = 0;

	for(int i = 1; i <= n; i++) {

		int temp = i;

		int temp2 = 0;



		while(temp) {

			temp2 += temp % 10;

			temp /= 10;

		}



		if(a <= temp2 && temp2 <= b) {

			total += i;

		}

	}



	printf("%d\n", total);

	return 0;

}



void swap(int *a, int *b) {

	int temp = *a;

	*a = *b;

	*b = temp;	

}



int max(int a, int b) {

	return (a > b) ? a : b;

}



int min(int a, int b) {

	return (a < b) ? a : b;

}



int abs(int a) {

	return (a < 0) ? -a : a;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main ()



{

    int a,c,N,A,B,i,x,y,z,k,j;

    j=0;

    scanf("%d%d%d",&N,&A,&B);

    c=N;

    for(i=1;i<=c;i++){

        N=i;

        x=N/10000.0;

        N=N-10000*x;

        y=N/1000.0;

        N=N-1000*y;

        z=N/100.0;

        N=N-z*100;

        a=N/10.0;

        N=N-a*10;



        k=a+z+x+y+N;

        if(k>=A && k<=B){

            j=i+j;

        }





    }

    printf("%d",j);

}


// Faster C++ solution for the same problem (measured speedup: 5.171052040721244x):
#include <stdio.h>

#include <string.h>



#define INT_MAX 2147483647

#define INT_MIN -2147483648



int max(int a, int b);

int min(int a, int b);

int abs(int a);



int n, a, b;



int main() {

	scanf("%d %d %d", &n, &a, &b);

	int total = 0;

	for(int i = 1; i <= n; i++) {

		int temp = i;

		int temp2 = 0;



		while(temp) {

			temp2 += temp % 10;

			temp /= 10;

		}



		if(a <= temp2 && temp2 <= b) {

			total += i;

		}

	}



	printf("%d\n", total);

	return 0;

}



void swap(int *a, int *b) {

	int temp = *a;

	*a = *b;

	*b = temp;	

}



int max(int a, int b) {

	return (a > b) ? a : b;

}



int min(int a, int b) {

	return (a < b) ? a : b;

}



int abs(int a) {

	return (a < 0) ? -a : a;

}
// Slower C++ solution:
#include<stdio.h>

int main()

{

    int i,j,k,l,m,n,o,a,b,sum;

    scanf("%d",&n);

    scanf("%d",&a);

    scanf("%d",&b);

    sum=0;

    for(o=0;o<=9;o++)

    {

        for(i=0;i<=9;i++)

        {

            for(j=0;j<=9;j++)

            {

                for(k=0;k<=9;k++)

                {

                    for(l=0;l<=9;l++)

                    {

                        for(m=a;m<=b&&10000*o+1000*i+100*j+10*k+l<=n;m++)

                        {

                            if(m==o+i+j+k+l)

                            {

                                sum=sum+10000*o+1000*i+100*j+10*k+l;

                                break;

                            }

                        }

                    }

                }

            }

        }

    }

    printf("%d",sum);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.9646600206322906x):
#include <stdio.h>

#include <string.h>



#define INT_MAX 2147483647

#define INT_MIN -2147483648



int max(int a, int b);

int min(int a, int b);

int abs(int a);



int n, a, b;



int main() {

	scanf("%d %d %d", &n, &a, &b);

	int total = 0;

	for(int i = 1; i <= n; i++) {

		int temp = i;

		int temp2 = 0;



		while(temp) {

			temp2 += temp % 10;

			temp /= 10;

		}



		if(a <= temp2 && temp2 <= b) {

			total += i;

		}

	}



	printf("%d\n", total);

	return 0;

}



void swap(int *a, int *b) {

	int temp = *a;

	*a = *b;

	*b = temp;	

}



int max(int a, int b) {

	return (a > b) ? a : b;

}



int min(int a, int b) {

	return (a < b) ? a : b;

}



int abs(int a) {

	return (a < 0) ? -a : a;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define pb push_back

#define rep(i,n) for(int i=0;i<n;i++)

#define rep1(i,n) for(int i=1;i<=n;i++)

#define mp make_pair

#define F first

#define S second

#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

typedef long long ll;

vector<int> g[100005];

ll q,n;



int main()

{

    //IOS;

    while(cin>>n)

    {

        ll sum=0;

        ll A,B;

        cin>>A>>B;

        for(int i=1;i<=n;i++)

        {

            ll a=i/10000,b=(i%10000)/1000,c=(i%1000)/100,d=(i%100)/10,e=i%10;

            if(a+b+c+d+e<=B&&a+b+c+d+e>=A) sum+=i;

        }

        cout<<sum<<"\n";

    }



    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 18.49800177661608x):
#include <stdio.h>

#include <string.h>



#define INT_MAX 2147483647

#define INT_MIN -2147483648



int max(int a, int b);

int min(int a, int b);

int abs(int a);



int n, a, b;



int main() {

	scanf("%d %d %d", &n, &a, &b);

	int total = 0;

	for(int i = 1; i <= n; i++) {

		int temp = i;

		int temp2 = 0;



		while(temp) {

			temp2 += temp % 10;

			temp /= 10;

		}



		if(a <= temp2 && temp2 <= b) {

			total += i;

		}

	}



	printf("%d\n", total);

	return 0;

}



void swap(int *a, int *b) {

	int temp = *a;

	*a = *b;

	*b = temp;	

}



int max(int a, int b) {

	return (a > b) ? a : b;

}



int min(int a, int b) {

	return (a < b) ? a : b;

}



int abs(int a) {

	return (a < 0) ? -a : a;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



int main(){

    int n,a,b,ans=0,d,p=0;

    cin >> n >> a >> b;

    for(int t=1;t<=n;t++){

        d=t,p=0;

        while(d>=1){

            p+=d%10;

            d/=10;

        }

        if(p>=a && p<=b){

            ans+=t;

        }

    }

    cout << ans << '\n';

}

// Faster C++ solution for the same problem (measured speedup: 5.227992117053176x):
#include <stdio.h>

#include <string.h>



#define INT_MAX 2147483647

#define INT_MIN -2147483648



int max(int a, int b);

int min(int a, int b);

int abs(int a);



int n, a, b;



int main() {

	scanf("%d %d %d", &n, &a, &b);

	int total = 0;

	for(int i = 1; i <= n; i++) {

		int temp = i;

		int temp2 = 0;



		while(temp) {

			temp2 += temp % 10;

			temp /= 10;

		}



		if(a <= temp2 && temp2 <= b) {

			total += i;

		}

	}



	printf("%d\n", total);

	return 0;

}



void swap(int *a, int *b) {

	int temp = *a;

	*a = *b;

	*b = temp;	

}



int max(int a, int b) {

	return (a > b) ? a : b;

}



int min(int a, int b) {

	return (a < b) ? a : b;

}



int abs(int a) {

	return (a < 0) ? -a : a;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()



{

    int n,a,b;

    scanf("%d %d %d",&n,&a,&b);

    int i,j,x,y,s=0,hp;

    for(i=1;i<=n;i++)

    {

        x=0;

        y=i;

        for(j=0;;j++)

        {

            if(pow(10,j)>y)

            {

                hp=j-1;

                break;

            }

        }

        for(j=hp;j>=0;j--)

        {

            int power=pow(10,j);

            x=x+y/power;

            y=y%power;

        }







        if(x>=a&&x<=b)

        {

            s=s+i;

        }

    }

    printf("%d",s);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.194491783009486x):
#include <stdio.h>

     

int main() {

    int n, a, b, sum=0;

    scanf("%d %d %d", &n,&a,&b);

    for (int i=1; i <= n; i++) {

        int c = 0, t = i;

        for (int j = 0; j < 5; j++) {

          c += t % 10;

          t /= 10;

        }

		if (c >= a && c <= b) {

		sum += i;

		}

    }

      

	printf("%d",sum);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main ()



{

    int a,c,N,A,B,i,x,y,z,k,j;

    j=0;

    scanf("%d%d%d",&N,&A,&B);

    c=N;

    for(i=1;i<=c;i++){

        N=i;

        x=N/10000.0;

        N=N-10000*x;

        y=N/1000.0;

        N=N-1000*y;

        z=N/100.0;

        N=N-z*100;

        a=N/10.0;

        N=N-a*10;



        k=a+z+x+y+N;

        if(k>=A && k<=B){

            j=i+j;

        }





    }

    printf("%d",j);

}


// Faster C++ solution for the same problem (measured speedup: 5.162015936606347x):
#include <stdio.h>

     

int main() {

    int n, a, b, sum=0;

    scanf("%d %d %d", &n,&a,&b);

    for (int i=1; i <= n; i++) {

        int c = 0, t = i;

        for (int j = 0; j < 5; j++) {

          c += t % 10;

          t /= 10;

        }

		if (c >= a && c <= b) {

		sum += i;

		}

    }

      

	printf("%d",sum);

	return 0;

}