import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int sum = 0;

        for(int a = 0; a <= 9; a++){
            for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            }
        }
        System.out.println(sum);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int sum = 0;

        for(int a = 0; a <= 9; a++){
            for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            }
        }
        System.out.println(sum);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int sum = 0;

        for(int a = 0; a <= 9; a++){
            for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            }
        }
        System.out.println(sum);
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int sum = 0;

        for(int a = 0; a <= 9; a++){
            for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            }
        }
        System.out.println(sum);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan int y = scan.nextInt(); y scan.nextInt() scan.nextInt scan int sum = 0; sum 0 for(int a = 0; a <= 9; a++){
            for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            }
        } int a = 0; int a = 0; a 0 a <= 9 a 9 a++ a++ a {
            for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            }
        } {
            for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            }
        } for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            } int b = 0; int b = 0; b 0 b <= 9 b 9 b++ b++ b {
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            } {
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            } for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                } int c = 0; int c = 0; c 0 c <= 9 c 9 c++ c++ c {
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                } {
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                } for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    } int d = 0; int d = 0; d 0 d <= 9 d 9 d++ d++ d {
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    } {
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    } for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        } int e = 0; int e = 0; e 0 e <= 9 e 9 e++ e++ e {
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        } {
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        } if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            } (n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) (n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) (n >= 10000*a + 1000*b + 100*c + 10*d + e) n 10000*a + 1000*b + 100*c + 10*d + e 10*d 100*c 10000*a + 1000*b + 100*c + 10*d + e 10000*a 10000 a 1000*b 1000 b 100*c 100 c 10*d 10 d e (x <= a+b+c+d+e) x a+b+c+d+e d c a+b+c+d+e a b c d e (y >= a+b+c+d+e) y a+b+c+d+e d c a+b+c+d+e a b c d e {
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            } sum = sum + (10000*a + 1000*b + 100*c + 10*d + e) sum sum + (10000*a + 1000*b + 100*c + 10*d + e) sum (10000*a + 1000*b + 100*c + 10*d + e) 10*d 100*c 10000*a + 1000*b + 100*c + 10*d + e 10000*a 10000 a 1000*b 1000 b 100*c 100 c 10*d 10 d e System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int sum = 0;

        for(int a = 0; a <= 9; a++){
            for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            }
        }
        System.out.println(sum);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int sum = 0;

        for(int a = 0; a <= 9; a++){
            for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            }
        }
        System.out.println(sum);
    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int sum = 0;

        for(int a = 0; a <= 9; a++){
            for(int b = 0; b <= 9; b++){
                for(int c = 0; c <= 9; c++){
                    for(int d = 0; d <= 9; d++){
                        for(int e = 0; e <= 9; e++){
                            if ((n >= 10000*a + 1000*b + 100*c + 10*d + e) && (x <= a+b+c+d+e) && (y >= a+b+c+d+e) ){
                                sum = sum + (10000*a + 1000*b + 100*c + 10*d + e);
                            }
                        }
                    }
                }
            }
        }
        System.out.println(sum);
    }
}