let sum_digits i =
  let rec go acc j =
    if j = 0 then acc
    else go (acc + j mod 10) (j / 10)
  in go 0 i

let solve n a b =
  let rec go i acc =
    let s = sum_digits i
    in let newacc = if a <= s && s <= b then acc + i else acc
       in if i = n then newacc
          else go (i + 1) newacc
  in go 0 0

let () = Scanf.scanf "%d %d %d" solve |> print_int