#include <bits/stdc++.h>
using namespace std;

bool digit(int nm,int mx,int mn){
    int n = 0;
    while(nm){
        n += nm % 10;
        nm /= 10;
        //if(n > mx || n < mn) return 0;
    }
    if(n > mx || n < mn) return 0;
    return 1;
}

int main(){
    int n,sum = 0,a,b;
    cin >> n >> a >> b;
    for(int i = 1;i <= n;++i){
        if(digit(i,max(a,b),min(a,b))){
            //cout << i << "\n";
            sum += i;
        }
    }
    cout << sum << "\n";
    return 0;
}
