import Control.Applicative
import Data.Char

toInt :: String -> Integer
toInt str = 
    let skipSpace :: String -> String
        skipSpace "" = ""
        skipSpace (' ':xs) = skipSpace xs
        skipSpace x = x
        toDigit :: String -> Integer
        toDigit "" = 0 :: Integer
        toDigit (x:xs) 
            | isDigit x = (fromIntegral $ digitToInt x) + (toDigit xs) * 10 :: Integer
        in toDigit $ skipSpace $ reverse $ skipSpace str



main = do
    a <- mod <$> (toInt <$> getLine) <*> return 500 
    b <- toInt <$> getLine
    putStrLn $ if (a <= b) then "Yes" else "No"
