main :: IO ()
main = do
  p <- getLine
  if p == "#"
    then return ()
    else do
      putStrLn $ solve p
      main

solve :: String -> String
solve p = ask "A" p
  where
    ask :: String -> String -> String
    ask now []
      | now == "B" = "Yes"
      | otherwise = "No"
    ask "A" (x:xs)
      | x == '0' = ask "X" xs
      | otherwise = ask "Y" xs
    ask "B" (x:xs)
      | x == '0' = ask "Y" xs
      | otherwise = ask "X" xs
    ask "X" (x:xs)
      | x == '1' = ask "Z" xs
      | otherwise = "No"
    ask "Y" (x:xs)
      | x == '0' = ask "X" xs
      | otherwise = "No"
    ask "Z" (x:xs)
      | x == '0' = ask "W" xs
      | otherwise = ask "B" xs
    ask "W" (x:xs)
      | x == '0' = ask "B" xs
      | otherwise = ask "Y" xs