main = do
  (n:a:b:_) <- map read . words <$> getContents
  print $ sum $ filter (decSumIn a b) [1 .. n]

decSumIn a b n = a <= s && s <= b
  where s = decSum n

decSum n
  | q == 0 = r
  | otherwise = decSum q + r
  where (q, r) = n `divMod` 10
