let get_3_ints () = Scanf.scanf "%d %d %d" (fun u v w -> u,v,w)
let range ?(stride=1) u v =
  let rec f0 i a = if i>v then a else f0 (i+stride) (i::a)
  in f0 u []
let char_list_of_string str = 
  let rec f0 i a =
    if i<0 then a else f0 (i-1) (str.[i]::a)
  in f0 (String.length str - 1) []

let () =
  let (n,a,b) = get_3_ints ()
  in
  range 1 n
  |> List.fold_left (fun u v ->
    (* Printf.printf "%d\n" v; *)
    v
    |> string_of_int
    |> char_list_of_string
    |> List.fold_left (fun u v -> u + (int_of_char v) - (int_of_char '0')) 0
    |> (fun k ->
      (* Printf.printf "  %d\n" k; *)
      if a<=k && k<=b then u+v else u
    )) 0
  |> Printf.printf "%d\n"