let main () =
  let n,a,b = Scanf.scanf "%d %d %d\n" (fun a b c -> a, b, c) in
  let rec func acc n = if n = 0 then acc else func (acc + n mod 10) (n / 10) in
  let res = ref 0 in
  for i = 0 to n do
    let s = func 0 n in
    if a <= s && s <= b then res := !res + i;
  done;
  Printf.printf "%d\n" !res

let _ = main ()
