import java.util.*;
public class Main {
  public static int sumDigits(int c){
  	int sum = 0;
        //自然数の各桁の和を計算
        while(c > 0){
          //最右端のけたの獲得
          sum += c % 10;
          //最右端の桁を取り除く
          c = c / 10;
        }
    return sum;
  }
  
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
	  //整数の上限 
      int n= sc.nextInt();
      //和の下限
      int a = sc.nextInt();
      //和の上限
      int b = sc.nextInt();
      
      int total = 0;
      
      for(int i = 1; i <= n; i++){
        int sum = sumDigits(i);
        if(sum >= a && sum <= b){
          total += i;
        }
      }
      System.out.print(total);
    }
} import java.util.*; util.* java public class Main {
  public static int sumDigits(int c){
  	int sum = 0;
        //自然数の各桁の和を計算
        while(c > 0){
          //最右端のけたの獲得
          sum += c % 10;
          //最右端の桁を取り除く
          c = c / 10;
        }
    return sum;
  }
  
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
	  //整数の上限 
      int n= sc.nextInt();
      //和の下限
      int a = sc.nextInt();
      //和の上限
      int b = sc.nextInt();
      
      int total = 0;
      
      for(int i = 1; i <= n; i++){
        int sum = sumDigits(i);
        if(sum >= a && sum <= b){
          total += i;
        }
      }
      System.out.print(total);
    }
} Main public static int sumDigits(int c){
  	int sum = 0;
        //自然数の各桁の和を計算
        while(c > 0){
          //最右端のけたの獲得
          sum += c % 10;
          //最右端の桁を取り除く
          c = c / 10;
        }
    return sum;
  } sumDigits {
  	int sum = 0;
        //自然数の各桁の和を計算
        while(c > 0){
          //最右端のけたの獲得
          sum += c % 10;
          //最右端の桁を取り除く
          c = c / 10;
        }
    return sum;
  } int sum = 0; sum 0 while(c > 0){
          //最右端のけたの獲得
          sum += c % 10;
          //最右端の桁を取り除く
          c = c / 10;
        } c > 0 c 0 {
          //最右端のけたの獲得
          sum += c % 10;
          //最右端の桁を取り除く
          c = c / 10;
        } sum += c % 10 sum c % 10 c 10 c = c / 10 c c / 10 c 10 return sum; sum int c c public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
	  //整数の上限 
      int n= sc.nextInt();
      //和の下限
      int a = sc.nextInt();
      //和の上限
      int b = sc.nextInt();
      
      int total = 0;
      
      for(int i = 1; i <= n; i++){
        int sum = sumDigits(i);
        if(sum >= a && sum <= b){
          total += i;
        }
      }
      System.out.print(total);
    } main {
      Scanner sc = new Scanner(System.in);
	  //整数の上限 
      int n= sc.nextInt();
      //和の下限
      int a = sc.nextInt();
      //和の上限
      int b = sc.nextInt();
      
      int total = 0;
      
      for(int i = 1; i <= n; i++){
        int sum = sumDigits(i);
        if(sum >= a && sum <= b){
          total += i;
        }
      }
      System.out.print(total);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n= sc.nextInt(); n sc.nextInt() sc.nextInt sc int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int total = 0; total 0 for(int i = 1; i <= n; i++){
        int sum = sumDigits(i);
        if(sum >= a && sum <= b){
          total += i;
        }
      } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
        int sum = sumDigits(i);
        if(sum >= a && sum <= b){
          total += i;
        }
      } {
        int sum = sumDigits(i);
        if(sum >= a && sum <= b){
          total += i;
        }
      } int sum = sumDigits(i); sum sumDigits(i) sumDigits i if(sum >= a && sum <= b){
          total += i;
        } sum >= a && sum <= b sum >= a sum a sum <= b sum b {
          total += i;
        } total += i total i System.out.print(total) System.out.print System.out System System.out total String[] args args public class Main {
  public static int sumDigits(int c){
  	int sum = 0;
        //自然数の各桁の和を計算
        while(c > 0){
          //最右端のけたの獲得
          sum += c % 10;
          //最右端の桁を取り除く
          c = c / 10;
        }
    return sum;
  }
  
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
	  //整数の上限 
      int n= sc.nextInt();
      //和の下限
      int a = sc.nextInt();
      //和の上限
      int b = sc.nextInt();
      
      int total = 0;
      
      for(int i = 1; i <= n; i++){
        int sum = sumDigits(i);
        if(sum >= a && sum <= b){
          total += i;
        }
      }
      System.out.print(total);
    }
} public class Main {
  public static int sumDigits(int c){
  	int sum = 0;
        //自然数の各桁の和を計算
        while(c > 0){
          //最右端のけたの獲得
          sum += c % 10;
          //最右端の桁を取り除く
          c = c / 10;
        }
    return sum;
  }
  
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
	  //整数の上限 
      int n= sc.nextInt();
      //和の下限
      int a = sc.nextInt();
      //和の上限
      int b = sc.nextInt();
      
      int total = 0;
      
      for(int i = 1; i <= n; i++){
        int sum = sumDigits(i);
        if(sum >= a && sum <= b){
          total += i;
        }
      }
      System.out.print(total);
    }
} Main
import java.util.*;
public class Main {
  public static int sumDigits(int c){
  	int sum = 0;
        //自然数の各桁の和を計算
        while(c > 0){
          //最右端のけたの獲得
          sum += c % 10;
          //最右端の桁を取り除く
          c = c / 10;
        }
    return sum;
  }
  
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
	  //整数の上限 
      int n= sc.nextInt();
      //和の下限
      int a = sc.nextInt();
      //和の上限
      int b = sc.nextInt();
      
      int total = 0;
      
      for(int i = 1; i <= n; i++){
        int sum = sumDigits(i);
        if(sum >= a && sum <= b){
          total += i;
        }
      }
      System.out.print(total);
    }
}