


"""simple docstring"""







import os


def 	lowercase     (							)-> Optional[Any]:
  '''simple docstring'''







  a		:						int 				=     0
  a		:						Union[str, Any] 				=     0
  with open(os.path.dirname(A_			) + "/p022_names.txt"			) as file:
    a		:						List[Any] 				=     str(file.readlines()[0]			)
    a		:						Optional[int] 				=     name.replace("\""    ,  ""			).split(","			)

  name.sort()
  for i in range(len(A_			)			):
    for j in name[i]:
      temp_sum += ord(A_			) - ord("A"			) + 1
    total_sum += (i + 1) * temp_sum
    a		:						List[Any] 				=     0
  return total_sum


if __name__ == "__main__":
 print(solution())










"""simple docstring"""







def 	lowercase     (							A_    ,  A_			)-> list[tuple[int, int, int]]:
  '''simple docstring'''







  a		:						Union[str, Any] 				=     sorted(A_    ,  key=lambda A_			: edge[2]			)

  a		:						List[Any] 				=     list(range(A_			)			)

  def find_parent(A_			):
    if i != parent[i]:
      a		:						Dict 				=     find_parent(parent[i]			)
    return parent[i]

  a		:						Optional[Any] 				=     0
  a		:						Optional[int] 				=     []

  for edge in edges:
    a		:						List[str] 				=     find_parent(edge[0]			)
    a		:						int 				=     find_parent(edge[1]			)
    if parent_a != parent_b:
      minimum_spanning_tree_cost += edge[2]
      minimum_spanning_tree.append(A_			)
      a		:						Tuple 				=     parent_b

  return minimum_spanning_tree


if __name__ == "__main__":  # pragma: no cover
 __lowercase   ,				__lowercase          = list(map(int, input().strip().split()))
 __lowercase          = []

 for _ in range(num_edges):
  __lowercase   ,				__lowercase   ,				__lowercase          = (int(x) for x in input().strip().split())
  edges.append((nodea, nodea, cost))

 kruskal(num_nodes, edges)






