digitSum :: Int -> Int
digitSum 0 = 0
digitSum x = (x `mod` 10) + digitSum (x `div` 10)

solve :: [Int] -> Int
solve (n:a:b:_) = sum $ filter inInterval $ map digitSum [1..n]
	where inInterval x = a <= x && x <= b

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