import Control.Applicative
import Control.Monad
 
main :: IO ()
main = do
    n <- readLn
    putStrLn $ secu (intToDigit n)
    
secu :: [Int] -> String 
secu []    = "Bad"
secu [n]   = "Bad"
secu (n:ns)  = if n == head ns then "Yes" else secu ns

intToDigit :: Int -> [Int]
intToDigit 0 = []
intToDigit n = mod n 10 : intToDigit (div n 10)