

'''simple docstring'''






from __future__ import annotations

from typing import Any






class     lowercase_			:




  """simple docstring"""




  def __init__(   self     :  Union[str, Any]      ,lowercase__     :  Any    ):
   __lowercase													=				num_of_nodes
   __lowercase													=				[]
   __lowercase													=				{}






  def       SCREAMING_SNAKE_CASE   (   self     :  List[Any]      ,lowercase__     :  Optional[Any]      ,lowercase__     :  int      ,lowercase__     :  List[Any]    ):
   self.m_edges.append([u_node, v_node, weight]    )






  def       SCREAMING_SNAKE_CASE   (   self     :  str      ,lowercase__     :  Union[str, Any]    ):





   if self.m_component[u_node] == u_node:
    return u_node
   return self.find_component(self.m_component[u_node]    )






  def       SCREAMING_SNAKE_CASE   (   self     :  List[str]      ,lowercase__     :  str    ):





   if self.m_component[u_node] != u_node:
    for k in self.m_component:
     __lowercase													=				self.find_component(_lowerCamelCase    )






  def       SCREAMING_SNAKE_CASE   (   self     :  Dict      ,lowercase__     :  Tuple      ,lowercase__     :  Dict      ,lowercase__     :  Optional[int]    ):





   if component_size[u_node] <= component_size[v_node]:
    __lowercase													=				v_node
    component_size[v_node] += component_size[u_node]
    self.set_component(_lowerCamelCase    )

   elif component_size[u_node] >= component_size[v_node]:
    __lowercase													=				self.find_component(_lowerCamelCase    )
    component_size[u_node] += component_size[v_node]
    self.set_component(_lowerCamelCase    )






  def       SCREAMING_SNAKE_CASE   (   self     :  Optional[int]    ):
   __lowercase													=				[]
   __lowercase													=				0

   __lowercase													=				[-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    )

   __lowercase													=				self.m_num_of_nodes

   while num_of_components > 1:
    for edge in self.m_edges:
     __lowercase						,			__lowercase						,			__lowercase													=				edge

     __lowercase													=				self.m_component[u]
     __lowercase													=				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
       ):
        __lowercase													=				[u, v, w]

    for edge in minimum_weight_edge:
     if isinstance(_lowerCamelCase      ,_lowerCamelCase    ):
      __lowercase						,			__lowercase						,			__lowercase													=				edge

      __lowercase													=				self.m_component[u]
      __lowercase													=				self.m_component[v]

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

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


def 	_A  (					):
 pass


if __name__ == "__main__":
 import doctest

 doctest.testmod()




'''simple docstring'''






def 	_A  (					A__ = 1000000   ):






 """simple docstring"""



 __lowercase													=				set(range(3  ,       A__  ,       2   )   )
 primes.add(2   )
 for p in range(3  ,       A__  ,       2   ):
  if p not in primes:
   continue
  primes.difference_update(set(range(p * p  ,       A__  ,       A__   )   )   )

 __lowercase													=				[float(A__   ) for n in range(limit + 1   )]

 for p in primes:
  for n in range(A__  ,       limit + 1  ,       A__   ):
   phi[n] *= 1 - 1 / p

 return int(sum(phi[2:]   )   )


if __name__ == "__main__":
 print(f'{solution() = }')

