
import java.io.BufferedReader
import java.io.InputStreamReader

fun main(args: Array<String>) {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val n = br.readLine()
    var flag = false
    for (i in 0..1) {
        flag = flag or (n[i] == n[i+1] && n[i] == n[i+2])
    }
    println(if (flag) "Yes" else "No")
}