import java.util.Scanner;

public class Main {

    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 answer = 0;
        for (int i=1; i<=n; i++){
            if (keta(i) >= a && keta(i) <= b){
                answer += i;
            }
        }

        System.out.println(answer);
    }

    private static int keta(int a){
        int man = a / 10000;
        int amari = a % 10000;
        int sen = amari / 1000;
        amari = a % 1000;
        int hyaku = amari / 100;
        amari = amari % 100;
        int zyuu = amari / 10;
        amari = amari % 10;
        return man + sen + hyaku + zyuu + amari;
    }

} import java.util.Scanner; Scanner java.util public class Main {

    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 answer = 0;
        for (int i=1; i<=n; i++){
            if (keta(i) >= a && keta(i) <= b){
                answer += i;
            }
        }

        System.out.println(answer);
    }

    private static int keta(int a){
        int man = a / 10000;
        int amari = a % 10000;
        int sen = amari / 1000;
        amari = a % 1000;
        int hyaku = amari / 100;
        amari = amari % 100;
        int zyuu = amari / 10;
        amari = amari % 10;
        return man + sen + hyaku + zyuu + amari;
    }

} Main 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 answer = 0;
        for (int i=1; i<=n; i++){
            if (keta(i) >= a && keta(i) <= b){
                answer += i;
            }
        }

        System.out.println(answer);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int answer = 0;
        for (int i=1; i<=n; i++){
            if (keta(i) >= a && keta(i) <= b){
                answer += i;
            }
        }

        System.out.println(answer);
    } 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 answer = 0; answer 0 for (int i=1; i<=n; i++){
            if (keta(i) >= a && keta(i) <= b){
                answer += i;
            }
        } int i=1; int i=1; i 1 i<=n i n i++ i++ i {
            if (keta(i) >= a && keta(i) <= b){
                answer += i;
            }
        } {
            if (keta(i) >= a && keta(i) <= b){
                answer += i;
            }
        } if (keta(i) >= a && keta(i) <= b){
                answer += i;
            } keta(i) >= a && keta(i) <= b keta(i) >= a keta(i) keta i a keta(i) <= b keta(i) keta i b {
                answer += i;
            } answer += i answer i System.out.println(answer) System.out.println System.out System System.out answer String[] args args private static int keta(int a){
        int man = a / 10000;
        int amari = a % 10000;
        int sen = amari / 1000;
        amari = a % 1000;
        int hyaku = amari / 100;
        amari = amari % 100;
        int zyuu = amari / 10;
        amari = amari % 10;
        return man + sen + hyaku + zyuu + amari;
    } keta {
        int man = a / 10000;
        int amari = a % 10000;
        int sen = amari / 1000;
        amari = a % 1000;
        int hyaku = amari / 100;
        amari = amari % 100;
        int zyuu = amari / 10;
        amari = amari % 10;
        return man + sen + hyaku + zyuu + amari;
    } int man = a / 10000; man a / 10000 a 10000 int amari = a % 10000; amari a % 10000 a 10000 int sen = amari / 1000; sen amari / 1000 amari 1000 amari = a % 1000 amari a % 1000 a 1000 int hyaku = amari / 100; hyaku amari / 100 amari 100 amari = amari % 100 amari amari % 100 amari 100 int zyuu = amari / 10; zyuu amari / 10 amari 10 amari = amari % 10 amari amari % 10 amari 10 return man + sen + hyaku + zyuu + amari; man + sen + hyaku + zyuu + amari zyuu hyaku man + sen + hyaku + zyuu + amari man sen hyaku zyuu amari int a a public class Main {

    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 answer = 0;
        for (int i=1; i<=n; i++){
            if (keta(i) >= a && keta(i) <= b){
                answer += i;
            }
        }

        System.out.println(answer);
    }

    private static int keta(int a){
        int man = a / 10000;
        int amari = a % 10000;
        int sen = amari / 1000;
        amari = a % 1000;
        int hyaku = amari / 100;
        amari = amari % 100;
        int zyuu = amari / 10;
        amari = amari % 10;
        return man + sen + hyaku + zyuu + amari;
    }

} public class Main {

    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 answer = 0;
        for (int i=1; i<=n; i++){
            if (keta(i) >= a && keta(i) <= b){
                answer += i;
            }
        }

        System.out.println(answer);
    }

    private static int keta(int a){
        int man = a / 10000;
        int amari = a % 10000;
        int sen = amari / 1000;
        amari = a % 1000;
        int hyaku = amari / 100;
        amari = amari % 100;
        int zyuu = amari / 10;
        amari = amari % 10;
        return man + sen + hyaku + zyuu + amari;
    }

} Main
import java.util.Scanner;

public class Main {

    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 answer = 0;
        for (int i=1; i<=n; i++){
            if (keta(i) >= a && keta(i) <= b){
                answer += i;
            }
        }

        System.out.println(answer);
    }

    private static int keta(int a){
        int man = a / 10000;
        int amari = a % 10000;
        int sen = amari / 1000;
        amari = a % 1000;
        int hyaku = amari / 100;
        amari = amari % 100;
        int zyuu = amari / 10;
        amari = amari % 10;
        return man + sen + hyaku + zyuu + amari;
    }

}
