main = interact$show.solve.map read.words

solve :: [Int] -> Int
solve [n,a,b] = sum [x|x <- l n, bounds (culc x) a b]
 where
  l x = [a| a<-[1..10000], a<=x]
  bounds x a b = a<=x && x<=b
  culc 0 = 0
  culc x = mod x 10 + culc (div x 10)