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**?
S = input()
cnt = 0
for i in range(3):
  if S[i]==S[i+1]:
    cnt += 1
    if cnt>=3:
      print("Yes")
      exit()
  else:
    cnt = 0
print("No")
S = input()
cnt = 1
for i in range(3):
  if S[i]==S[i+1]:
    cnt += 1
    if cnt>=3:
      print("Yes")
      exit()
  else:
    cnt = 1
print("No")