#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    int n, a, b, sum=0;
    int tmp1, tmp2, tmp3, tmp4, tmp5;
    scanf("%d%d%d", &n, &a, &b);
    
    rep(i, 0, n+1){
        if(i<10){
            if(i>=a && i<= b){
                sum += i;
            }
        }
        else if(i<100){
            tmp1 = i/10;
            tmp2 = i-tmp1*10;
            if((tmp1+tmp2)>=a && (tmp1+tmp2)<= b){
                sum += i;
            }
        }
        else if(i<1000){
            tmp1 = i/100;
            tmp2 = (i-(tmp1*100))/10;
            tmp3 = (i-(tmp1*100)-(tmp2*10))/1;
            if((tmp1+tmp2+tmp3)>=a && (tmp1+tmp2+tmp3)<= b){
                sum += i;
            }           
        }
        else if(i<10000){
            tmp1 = i/1000;
            tmp2 = (i-(tmp1*1000))/100;
            tmp3 = (i-(tmp1*1000)-(tmp2*100))/10;
            tmp4 = (i-(tmp1*1000)-(tmp2*100)-(tmp3*10))/1;
            if((tmp1+tmp2+tmp3+tmp4)>=a && (tmp1+tmp2+tmp3+tmp4)<= b){
                sum += i;
            } 
        }
        else{
            tmp1 = i/10000;
            tmp2 = (i-(tmp1*10000))/1000;
            tmp3 = (i-(tmp1*10000)-(tmp2*1000))/100;
            tmp4 = (i-(tmp1*10000)-(tmp2*1000)-(tmp3*100))/10;
            tmp5 = (i-(tmp1*10000)-(tmp2*1000)-(tmp3*100)-(tmp4*10))/1;
            if((tmp1+tmp2+tmp3+tmp4+tmp5)>=a && (tmp1+tmp2+tmp3+tmp4+tmp5)<= b){
                sum += i;
            }     
        }

    }
    cout << sum << endl;
}

Measured memory_bytes: 256