


'''simple docstring'''
import os





def 					a__       (					)    ->	Tuple:
    with open(os.path.dirname(lowerCAmelCase__						) + '''/p022_names.txt'''						) as file:
        UpperCAmelCase__			:		str													=				str(file.readlines()[0]						)
        UpperCAmelCase__			:		Optional[int]													=				names.replace('''"'''  ,					''''''						).split(''','''						)

    names.sort()

    UpperCAmelCase__			:		Tuple													=				0
    UpperCAmelCase__			:		List[str]													=				0

    for i, name in enumerate(lowerCAmelCase__						):
        for letter in name:
            name_score += ord(lowerCAmelCase__						) - 64

        total_score += (i + 1) * name_score
        UpperCAmelCase__			:		Tuple													=				0
    return total_score


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


from __future__ import annotations

from typing import Any



class 		UpperCamelCase__  :
   def __init__(self :					Union[str, Any]					,				snake_case_ :					int   ):
    __a :  Dict						=  num_of_nodes
    __a :  list[list[int]]						=  []
    __a :  dict[int, int]						=  {}
   def       lowerCAmelCase			(self :					Optional[Any]					,				snake_case_ :					int					,				snake_case_ :					int					,				snake_case_ :					int   ):
    self.m_edges.append([u_node, v_node, weight]   )
   def       lowerCAmelCase			(self :					Any					,				snake_case_ :					int   ):

    if self.m_component[u_node] == u_node:
     return u_node
    return self.find_component(self.m_component[u_node]   )
   def       lowerCAmelCase			(self :					str					,				snake_case_ :					int   ):

    if self.m_component[u_node] != u_node:
     for k in self.m_component:
      __a :  Optional[int]						=  self.find_component(snake_case_   )
   def       lowerCAmelCase			(self :					Any					,				snake_case_ :					list[int]					,				snake_case_ :					int					,				snake_case_ :					int   ):

    if component_size[u_node] <= component_size[v_node]:
     __a :  List[str]						=  v_node
     component_size[v_node] += component_size[u_node]
     self.set_component(snake_case_   )

    elif component_size[u_node] >= component_size[v_node]:
     __a :  Optional[int]						=  self.find_component(snake_case_   )
     component_size[u_node] += component_size[v_node]
     self.set_component(snake_case_   )







   def       lowerCAmelCase			(self :					Optional[Any]   ):
    __a :  str						=  []
    __a :  int						=  0

    __a :  list[Any]						=  [-1] * self.m_num_of_nodes

    # A list of components (initialized to all of the nodes)
    for node in range(self.m_num_of_nodes   ):
     self.m_component.update({node: node}   )
     component_size.append(1   )

    __a :  Union[str, Any]						=  self.m_num_of_nodes

    while num_of_components > 1:
     for edge in self.m_edges:
      __a				,       __a				,       __a :  Optional[Any]						=  edge

      __a :  List[str]						=  self.m_component[u]
      __a :  List[Any]						=  self.m_component[v]

      if u_component != v_component:

       for component in (u_component, v_component):
        if (
            minimum_weight_edge[component] == -1
            or minimum_weight_edge[component][2] > w
        ):
         __a :  str						=  [u, v, w]

     for edge in minimum_weight_edge:
      if isinstance(snake_case_					,				snake_case_   ):
       __a				,       __a				,       __a :  str						=  edge

       __a :  Any						=  self.m_component[u]
       __a :  Any						=  self.m_component[v]

       if u_component != v_component:
        mst_weight += w
        self.union(snake_case_					,				snake_case_					,				snake_case_   )
        print(f"Added edge [{u} - {v}]\nAdded weight: {w}\n"   )
        num_of_components -= 1

     __a :  Optional[int]						=  [-1] * self.m_num_of_nodes
    print(f"The total weight of the minimal spanning tree is: {mst_weight}"   )





def    __UpperCamelCase     (				):
 pass


if __name__ == "__main__":
      import doctest

      doctest.testmod()
