We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**.  You are given a 4-digit integer N. Answer the question: Is N **good**?
a=int(input());print('YNeos'[a//10%111<1or a%1000%111<1::2])
a=int(input());print('YNeos'[a//10%111>0and a%1000%111>0::2])