main :: IO ()
main = do 
    [n, a, b] <- map read . words <$> getLine :: IO [Int]
    print .sum $ filter (isWhile a b) [1..n]

isWhile :: Int -> Int -> Int -> Bool
isWhile begin end n =  
    let a = sum . map (\c -> read [c]) $ show n
    in begin <= a && a <= end