let rec seq a b = if a > b then [] else a :: seq (a+1) b
let rec dig_sum x = if x = 0 then 0 else x mod 10 + dig_sum (x / 10)
let () =
  Scanf.scanf "%d %d %d" @@ fun n a b ->
    seq 1 n
    |> List.fold_left (fun s x ->
        let d = dig_sum x in
        if a <= d && d <= b then s+x else s) 0
    |> Printf.printf "%d\n"