(defn digits [n] (if-not (zero? n)(+ (mod n 10) (digits (quot n 10))) (mod n 10)))
(defn some_sums [[N,A,B]] (apply + (filter #(let [x (digits %)] (and (<= A x) (>= B x))) (range 1 (inc N)))))
(println (some_sums (map bigint(.split (read-line) " "))))