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: h, w = map(int, input().split(" "))
  tbl = [list(map(int, input().split(" "))) for i in range(10)]
  tbli = list(zip(*tbl))
  cost = [10**18] * 10
  cost[1] = 0
  sorttool = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  order = list(zip(tbli[1], sorttool))
  order.sort()
  del order[0]
  for i, (c, x) in enumerate(order):
      cost[x] = min(cost[x], tbli[1][x])
      if i == 0:
          continue
      for j in range(i):
          cost[x] = min(cost[x], cost[order[j][1]] + tbli[order[j][1]][x])
  cost.append(0)
  wall = [list(map(int, input().split(" "))) for i in range(h)]
  ans = 0
  for i in range(h):
      for j in range(w):
          ans += cost[wall[i][j]]
  print(ans)
  
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"}]