import Control.Applicative

main = do
    -- 整数の入力
    a <- getLine
    -- 出力
    if (a !! 0 == a !! 1 && a !! 0 == a !! 2) || (a !! 1 == a !! 2 && a !! 2 == a !! 3) then putStrLn "Yes" else putStrLn "No"

