module Main where

import           Data.List

toInt :: String -> Int
toInt s = read s :: Int

strToIntList :: String -> [Int]
strToIntList = map toInt . words

getIntList :: IO [Int]
getIntList = getLine >>= return . strToIntList

main :: IO ()
main = do
  nab <- getIntList
  print
    .   sum
    .   map fst
    .   filter (\(_, b) -> nab !! 1 <= b && b <= nab !! 2)
    $   zip
    <$> id
    <*> map (sum . tt)
    $   [1 .. head nab]

tt :: Int -> [Int]
tt = unfoldr fnc where
  fnc 0 = Nothing
  fnc n = Just (n `mod` 10, n `div` 10)
