open Core

let n, a, b = Scanf.scanf "%d %d %d" (fun n a b -> (n, a, b))

let nums = List.range 1 (n + 1)

let rec digits i = if i <= 0 then 0 else (i mod 10) + digits (i / 10)

let s =
  nums
  |> List.map ~f:(fun n ->
         let d = digits n in
         if a <= d && d <= b then n else 0)
  |> List.fold_left ~init:0 ~f:( + )

let () = Printf.printf "%d\n" s
