output_description: If N is **good** , print `Yes`; otherwise, print `No`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: import math
  
  
  # グラフの作成
  def make_list(V, E):
  
      edges = []
      path = [[0] * E for i in range(V)]  # ルート作成に必要になる
  
      for i in range(V):
          a = list(map(int, input().split()))
          for j in range(len(a)):
              # print("j",j)
              path[i][j] = i
              if j != i and a[j] == 0:
                  a[j] = 30000
                  path[i][j] = -3000
  
          edges.append((a))  #  有効辺グラフ
  
      return edges, path
  
  
  def mainasu_sycle(
      dist,
  ):  # 負のサイクルがあるか確認する    第一引数: 重みを含む配列  実装を確認していない
  
      for i in range(0, len(dist)):
          if dist[i][i] != 0:
              print("Negative cycle at : ", i + 1)
  
  
  # 最短経路をたどる
  def ConstructPath(p, i, j):
      i, j = int(i), int(j)
      print("i,j:", i, j)
      if i == j:
          print(
              i,
          )
      elif p[i][j] == -30000:
          print(i, "-", j)
      else:
          ConstructPath(p, i, p[i][j])
          print(
              j,
          )
  
  
  # フロイド・ワーシャル
  def warshall_floyd(glath, path):
  
      for k in range(len(glath)):
          for i in range(len(glath)):
              for j in range(len(glath[i])):
                  if glath[i][j] > glath[i][k] + glath[k][j]:
                      glath[i][j] = glath[i][k] + glath[k][j]
                      path[i][j] = path[k][j]
                  # glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
  
      return glath, path
  
  
  if __name__ == "__main__":
      H, W = [int(x) for x in str(input()).split()]  # グラフの大きさ
  
      cost_graph, graph = make_list(10, 10)
      wall, wall_graph = make_list(H, W)
  
      un_label = []
      for i in wall:
          for j in i:
              if j != -1 and j != 1:
                  un_label.append(j)
      cost = 0
  
      all_cost, all_graph = warshall_floyd(cost_graph, graph)
  
      for i in un_label:
          cost += all_cost[i][1]
  
      print(cost)
  
problem_description: Statement
  
  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**?
samples: [{"input": "1118", "output": "Yes\n    \n\nN is **good** , since it contains three consecutive 1.\n\n* * *"}, {"input": "7777", "output": "Yes\n    \n\nAn integer is also **good** when all the digits are the same.\n\n* * *"}, {"input": "1234", "output": "No"}]