import java.util.*;
 
public class Main {
    static int[] bits;
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        bits=new int[5];
        int a=sc.nextInt();
        int b=sc.nextInt();
        int tmp;
        int ans=0;
        for(int i=0;i<n;i++){
            update(0);
            tmp=0;
            for(int j=0;j<5;j++){
                tmp+=bits[j];
            }
            if(a<=tmp&&b>=tmp){
                ans+=i+1;
            }
        }
        System.out.println(ans);
 
    }
    static void update(int pointer){
        
        if(bits[pointer]==9){
            bits[pointer]=0;
            update(pointer+1);
            
        }else{
            bits[pointer]++;
        }
    }
} import java.util.*; util.* java public class Main {
    static int[] bits;
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        bits=new int[5];
        int a=sc.nextInt();
        int b=sc.nextInt();
        int tmp;
        int ans=0;
        for(int i=0;i<n;i++){
            update(0);
            tmp=0;
            for(int j=0;j<5;j++){
                tmp+=bits[j];
            }
            if(a<=tmp&&b>=tmp){
                ans+=i+1;
            }
        }
        System.out.println(ans);
 
    }
    static void update(int pointer){
        
        if(bits[pointer]==9){
            bits[pointer]=0;
            update(pointer+1);
            
        }else{
            bits[pointer]++;
        }
    }
} Main static int[] bits; bits public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        bits=new int[5];
        int a=sc.nextInt();
        int b=sc.nextInt();
        int tmp;
        int ans=0;
        for(int i=0;i<n;i++){
            update(0);
            tmp=0;
            for(int j=0;j<5;j++){
                tmp+=bits[j];
            }
            if(a<=tmp&&b>=tmp){
                ans+=i+1;
            }
        }
        System.out.println(ans);
 
    } main {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        bits=new int[5];
        int a=sc.nextInt();
        int b=sc.nextInt();
        int tmp;
        int ans=0;
        for(int i=0;i<n;i++){
            update(0);
            tmp=0;
            for(int j=0;j<5;j++){
                tmp+=bits[j];
            }
            if(a<=tmp&&b>=tmp){
                ans+=i+1;
            }
        }
        System.out.println(ans);
 
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc bits=new int[5] bits new int[5] 5 int a=sc.nextInt(); a sc.nextInt() sc.nextInt sc int b=sc.nextInt(); b sc.nextInt() sc.nextInt sc int tmp; tmp int ans=0; ans 0 for(int i=0;i<n;i++){
            update(0);
            tmp=0;
            for(int j=0;j<5;j++){
                tmp+=bits[j];
            }
            if(a<=tmp&&b>=tmp){
                ans+=i+1;
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            update(0);
            tmp=0;
            for(int j=0;j<5;j++){
                tmp+=bits[j];
            }
            if(a<=tmp&&b>=tmp){
                ans+=i+1;
            }
        } {
            update(0);
            tmp=0;
            for(int j=0;j<5;j++){
                tmp+=bits[j];
            }
            if(a<=tmp&&b>=tmp){
                ans+=i+1;
            }
        } update(0) update 0 tmp=0 tmp 0 for(int j=0;j<5;j++){
                tmp+=bits[j];
            } int j=0; int j=0; j 0 j<5 j 5 j++ j++ j {
                tmp+=bits[j];
            } {
                tmp+=bits[j];
            } tmp+=bits[j] tmp bits[j] bits j if(a<=tmp&&b>=tmp){
                ans+=i+1;
            } a<=tmp&&b>=tmp a<=tmp a tmp b>=tmp b tmp {
                ans+=i+1;
            } ans+=i+1 ans i+1 i 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args static void update(int pointer){
        
        if(bits[pointer]==9){
            bits[pointer]=0;
            update(pointer+1);
            
        }else{
            bits[pointer]++;
        }
    } update {
        
        if(bits[pointer]==9){
            bits[pointer]=0;
            update(pointer+1);
            
        }else{
            bits[pointer]++;
        }
    } if(bits[pointer]==9){
            bits[pointer]=0;
            update(pointer+1);
            
        }else{
            bits[pointer]++;
        } bits[pointer]==9 bits[pointer] bits pointer 9 {
            bits[pointer]=0;
            update(pointer+1);
            
        } bits[pointer]=0 bits[pointer] bits pointer 0 update(pointer+1) update pointer+1 pointer 1 {
            bits[pointer]++;
        } bits[pointer]++ bits[pointer] bits pointer int pointer pointer public class Main {
    static int[] bits;
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        bits=new int[5];
        int a=sc.nextInt();
        int b=sc.nextInt();
        int tmp;
        int ans=0;
        for(int i=0;i<n;i++){
            update(0);
            tmp=0;
            for(int j=0;j<5;j++){
                tmp+=bits[j];
            }
            if(a<=tmp&&b>=tmp){
                ans+=i+1;
            }
        }
        System.out.println(ans);
 
    }
    static void update(int pointer){
        
        if(bits[pointer]==9){
            bits[pointer]=0;
            update(pointer+1);
            
        }else{
            bits[pointer]++;
        }
    }
} public class Main {
    static int[] bits;
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        bits=new int[5];
        int a=sc.nextInt();
        int b=sc.nextInt();
        int tmp;
        int ans=0;
        for(int i=0;i<n;i++){
            update(0);
            tmp=0;
            for(int j=0;j<5;j++){
                tmp+=bits[j];
            }
            if(a<=tmp&&b>=tmp){
                ans+=i+1;
            }
        }
        System.out.println(ans);
 
    }
    static void update(int pointer){
        
        if(bits[pointer]==9){
            bits[pointer]=0;
            update(pointer+1);
            
        }else{
            bits[pointer]++;
        }
    }
} Main
import java.util.*;
 
public class Main {
    static int[] bits;
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        bits=new int[5];
        int a=sc.nextInt();
        int b=sc.nextInt();
        int tmp;
        int ans=0;
        for(int i=0;i<n;i++){
            update(0);
            tmp=0;
            for(int j=0;j<5;j++){
                tmp+=bits[j];
            }
            if(a<=tmp&&b>=tmp){
                ans+=i+1;
            }
        }
        System.out.println(ans);
 
    }
    static void update(int pointer){
        
        if(bits[pointer]==9){
            bits[pointer]=0;
            update(pointer+1);
            
        }else{
            bits[pointer]++;
        }
    }
}