stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
/*

--------------              |   /

      |                     |  /

      |                     | /

      |             *       |/          |    |         ------            *

      |                     |           |    |        /      \

      |             |       |\          |    |       |       |\          |

   \  |             |       | \         |    |       |       | \         |

    \ |             |       |  \        |    |        \     /   \        |

     V              |       |   \        \__/|         -----     \       |

*/

#include <bits/stdc++.h>

using namespace std;



#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);

#define endl '\n'

#define mem(i,j) memset(i,j,sizeof i);

#define F first

#define S second

#define pb push_back

#define mp make_pair

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

#define bit(s,i) (((s)>>(i))&1LL)

#define lowbit(x) (x&-x)

#define siz(v) (long long)v.size()

typedef long long ll;

typedef unsigned long long ull;

typedef pair<int,int> pii;

typedef pair<ll, ll> pll;

const double EPS  = 1e-8;

const int INF     = 0x3F3F3F3F;

const ll LINF     = 4611686018427387903;

const int MOD     = 1e9+7;

const int MAXN    = 2e5+9;

/*-----------------------------------------------------------------------------------------------------*/



string toInt(int a) {

    string s, c;

    while(a>0) {

        s.pb(a%10+'0');

        a/=10;

    }

    for(int i = s.size()-1; i>=0; i--) c.pb(s[i]);

    return c;

}



int main() {

    EmiliaMyWife



    int n, a, b;

    cin >> n >> a >> b;

    if(a>b) swap(a, b);

    ll ans =0;

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

        string s = toInt(i);

        //cout << s << endl;

        int cur=0;

        for(auto x: s) {

            cur+=(x-'0');

        }

        if(a<=cur && cur<=b) ans+=i;

    }

    cout << ans;



	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

    int N,A,B, i, temp, t, remainder, sum, total = 0;

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



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

        t = i;

        sum  = 0;

        while (t != 0){

              remainder = t % 10;

              sum += remainder;

              t /= 10;

           }



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

               total += i;

        }

    }



    printf("%d", total);



}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int change(int a){

    int re = 0;

    while(a>0){

        re += a%10;

        a/=10;

    }

    return re;

}

int main(){

    int n,a,b;

    cin >> n>> a >> b;

    long long int ans = 0;

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

        int re = change(i);

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

            ans += i;

//            cout << i <<endl;

        }

    }

    cout << ans <<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

    int N,A,B, i, temp, t, remainder, sum, total = 0;

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



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

        t = i;

        sum  = 0;

        while (t != 0){

              remainder = t % 10;

              sum += remainder;

              t /= 10;

           }



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

               total += i;

        }

    }



    printf("%d", total);



}

// Fastest known solution for this problem:
// Original C++ solution (slower):




#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,a,b,sum,sum2=0,temp=0,var,i;

    cin>>n>>a>>b;

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

    {



        sum=0,temp=i;

        while(temp!=0)

        {

            var=temp%10;

            sum=sum+var;

            temp=temp/10;

        }



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

        {



            sum2=sum2+i;

        }

    }

    cout<<sum2<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int a,b,c;

	int sum=0;

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

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

        int x = 0;

        int y = i;

        while(y != 0){

            x += (y%10);

            y = y / 10;

        }

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

        sum += i;

    }

}

	printf("%d",sum);  

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



int R , ans=0 ;



int dec(int n){

	int temp=0;

	while(n){

		temp+=n%10;

		n/=10;

	}

	return temp;	

}



int main()

{

	int N , a , b ;

	

	cin>>N>>a>>b;

	

	int m=min(a,b) , M=max(a,b) ;

	

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

		int te = dec(i);

		if( te>=m && te<=M )

			ans+=i;

	}

	

	cout<<ans<<endl;

	return 0;			

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int a,b,c;

	int sum=0;

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

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

        int x = 0;

        int y = i;

        while(y != 0){

            x += (y%10);

            y = y / 10;

        }

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

        sum += i;

    }

}

	printf("%d",sum);  

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#pragma GCC optimize("O3")

#include<bits/stdc++.h>

#define ll long long

#define endl '\n'

using namespace std;



int main(){

	ios::sync_with_stdio(0);cin.tie(0);

	ll n,a,b,ans=0;

	cin>>n>>a>>b;

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

		string str=to_string(i);

		ll cnt=0;

		for(char j:str)	cnt+=j-'0';

		if(a<=cnt&&cnt<=b)	ans+=i;

	}

	cout<<ans<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int a,b,c;

	int sum=0;

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

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

        int x = 0;

        int y = i;

        while(y != 0){

            x += (y%10);

            y = y / 10;

        }

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

        sum += i;

    }

}

	printf("%d",sum);  

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<string>

#include<cmath>

#include<set>

#include<cstdio>



#define endl '\n'

#define ll long long

#define ull unsigned ll

#define x first

#define y second



using namespace std;



int shuzihe(int x){

    int ans=0;

    while(x){

        ans+=x%10;

        x/=10;

    }

    return ans;

}

int main(){

    int n,a,b;

    cin>>n;

    cin>>a>>b;

    int temp;

    int ans=0;

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

        temp=shuzihe(i);

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

            ans+=i;

        }

    }

    cout<<ans<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int a,b,c;

	int sum=0;

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

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

        int x = 0;

        int y = i;

        while(y != 0){

            x += (y%10);

            y = y / 10;

        }

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

        sum += i;

    }

}

	printf("%d",sum);  

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <algorithm>

#include <cmath>



using namespace std;



int main(){

	

	int n, a, b;

	cin >> n >> a >> b;

	

	int ans = 0;

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

		string s = to_string(i);

		int dsum = 0;

		

		for(int j = 0; j < s.length(); j++){

			dsum = dsum + s[j] - '0';

		

		}

		

		if(a <= dsum && dsum <= b) ans = ans + i;

	

	}

	

	

	cout << ans << endl;

	

	return 0;

}

/*

+++++ +++++ +++++ +++++

+++++ +++++ ++

>,[[-<->]]



*/


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int a,b,c;

	int sum=0;

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

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

        int x = 0;

        int y = i;

        while(y != 0){

            x += (y%10);

            y = y / 10;

        }

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

        sum += i;

    }

}

	printf("%d",sum);  

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

 

int main() {

  int n, a, b;

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

  int count = 0;

  

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

  	int sum = 0;

  	

    for(int j = i; j != 0; j /= 10) {

      sum += j % 10;

    }

  

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

      count += i;

    }

  }

  

   printf("%d", count);

   

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<vector>

#include <unordered_map>  

#include <algorithm>

#include <functional>

#include <map>

#include <string>

#include <sstream>

#include <cmath>

#include <float.h>

using namespace std;





int main() {

	int n, a, b, sum, dig, num, sum2 = 0;

	cin >> n >> a >> b;

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

		num = i;

		sum = 0;

		while (num) {

			dig = num % 10;

			sum = sum + dig;

			num = num / 10;

		}

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

			sum2 += i;

		}

	}

	cout << sum2 << endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

 

int main() {

  int n, a, b;

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

  int count = 0;

  

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

  	int sum = 0;

  	

    for(int j = i; j != 0; j /= 10) {

      sum += j % 10;

    }

  

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

      count += i;

    }

  }

  

   printf("%d", count);

   

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define LLI long long int

#define ULTRA 2134567890

#define de(x) if(x!=0 && MODE==x)

#define MODE 1

using namespace std;



int main()

{

    int i,j;

    int N,A,B;



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

    int ans = 0;

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

    {

        int num = i;

        int sum = 0;

        while(num)

        {

            sum += num % 10;

            num /= 10;

        }

        if( A<=sum && sum<=B)

            ans += i;

    }

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





    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

 

int main() {

  int n, a, b;

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

  int count = 0;

  

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

  	int sum = 0;

  	

    for(int j = i; j != 0; j /= 10) {

      sum += j % 10;

    }

  

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

      count += i;

    }

  }

  

   printf("%d", count);

   

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//Author: Suifeng0214

#include <bits/stdc++.h>

#define int long long

using namespace std;

map <char ,int> mp;

signed main()

{

	ios::sync_with_stdio(0);

	cin.tie(0);

	int n, a, b;

	cin >> n >> a >> b;

	int ans = 0;

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

		int tmp = i, nums=0;

		while(tmp>0){

			nums += tmp %10;

			tmp /= 10;

		}

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

			ans += i;

		}

		

	} 

	cout << ans << "\n";

} 

// Optimized solution to the same problem (faster):
#include<stdio.h>

 

int main() {

  int n, a, b;

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

  int count = 0;

  

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

  	int sum = 0;

  	

    for(int j = i; j != 0; j /= 10) {

      sum += j % 10;

    }

  

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

      count += i;

    }

  }

  

   printf("%d", count);

   

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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();

}








// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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";

}




// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem: