
from decimal import Decimal, getcontext
from math import ceil, factorial

def a__    (       A_					):






  '''simple docstring'''





  if not isinstance(A_,     A_					):
    raise TypeError("""Undefined for non-integers"""					)
  elif precision < 1:
    raise ValueError("""Undefined for non-natural numbers"""					)

  __magic_name__				     =       precision
  __magic_name__				     =       ceil(precision / 14					)
  __magic_name__				     =       426880 * Decimal(10005					).sqrt()
  __magic_name__				     =       1
  __magic_name__				     =       13591409
  __magic_name__				     =       Decimal(A_					)
  for k in range(1,     A_					):
    __magic_name__				     =       factorial(6 * k					) // (factorial(3 * k					) * factorial(A_					) ** 3)
    linear_term += 545140134
    exponential_term *= -262537412640768000
    partial_sum += Decimal(multinomial_term * linear_term					) / exponential_term
  return str(constant_term / partial_sum					)[:-1]


if __name__ == "__main__":
    __lowerCAmelCase			:     str           =   50
    print(F'''The first {n} digits of pi is: {pi(n)}''')






"""simple docstring"""
from __future__ import annotations

import os
from collections.abc import Mapping

_lowerCAmelCase    :Tuple     =					tuple[int, int]
class 							_UpperCAmelCase							:





     '''simple docstring'''



     def __init__(					self       ,	A       ,	A		)							->					None:
         _UpperCAmelCase							:  set[int]											=    vertices
         _UpperCAmelCase							:  dict[EdgeT, int]											=    {
             (min(A		), max(A		)): weight for edge, weight in edges.items()
         }





     def  __lowerCAmelCase	(					self       ,	A       ,	A		)							->					None:
         self.vertices.add(edge[0]		)
         self.vertices.add(edge[1]		)
         _UpperCAmelCase							:  List[Any]											=    weight





     def  __lowerCAmelCase	(					self		)							->					Graph:
         _UpperCAmelCase							:  Graph											=    Graph({min(self.vertices		)}       ,	{}		)
         _UpperCAmelCase							:  EdgeT
         _UpperCAmelCase							:  int
         _UpperCAmelCase							:  EdgeT
         _UpperCAmelCase							:  int

         while len(subgraph.vertices		) < len(self.vertices		):
             _UpperCAmelCase							:  Any											=    max(self.edges.values()		) + 1
             for edge, weight in self.edges.items():
                 if (edge[0] in subgraph.vertices) ^ (edge[1] in subgraph.vertices):
                     if weight < min_weight:
                         _UpperCAmelCase							:  Tuple											=    edge
                         _UpperCAmelCase							:  Optional[int]											=    weight

             subgraph.add_edge(A       ,	A		)

         return subgraph





def  lowerCamelCase_						(UpperCamelCase__		:		str = "p107_network.txt"							):
    _UpperCAmelCase							:  str											=    os.path.abspath(os.path.dirname(UpperCamelCase__							)							)
    _UpperCAmelCase							:  str											=    os.path.join(UpperCamelCase__     ,       UpperCamelCase__							)
    _UpperCAmelCase							:  dict[EdgeT, int]											=    {}
    _UpperCAmelCase							:  list[str]
    _UpperCAmelCase							:  int
    _UpperCAmelCase							:  int

    with open(UpperCamelCase__							) as f:
        _UpperCAmelCase							:  str											=    f.read().strip().split('''\n'''							)

    _UpperCAmelCase							:  List[Any]											=    [line.split(''','''							) for line in data]

    for edgea in range(1     ,       len(UpperCamelCase__							)							):
        for edgea in range(UpperCamelCase__							):
            if adjaceny_matrix[edgea][edgea] != "-":
                _UpperCAmelCase							:  Optional[Any]											=    int(adjaceny_matrix[edgea][edgea]							)

    _UpperCAmelCase							:  Graph											=    Graph(set(range(len(UpperCamelCase__							)							)							)     ,       UpperCamelCase__							)

    _UpperCAmelCase							:  Graph											=    graph.prims_algorithm()

    _UpperCAmelCase							:  int											=    sum(graph.edges.values()							)
    _UpperCAmelCase							:  int											=    sum(subgraph.edges.values()							)

    return initial_total - optimal_total


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


