



'''simple docstring'''



from __future__ import annotations

from typing import Generic, TypeVar

lowerCamelCase	 =       TypeVar("""T""")





class _UpperCamelCase		(     Generic[T]		):





				'''simple docstring'''





				def __init__(							self  :  List[str]  ,       _lowerCAmelCase  :  T):







											'''simple docstring'''

											__lowercase       	=data
											__lowercase       	=self
											__lowercase       	=0





class _UpperCamelCase		(     Generic[T]		):





				'''simple docstring'''





				def __init__(							self  :  Tuple):







											'''simple docstring'''

											__lowercase       	={}

				def 				__lowerCamelCase     (							self  :  Optional[Any]  ,       _lowerCAmelCase  :  T):







											'''simple docstring'''

											__lowercase       	=DisjointSetTreeNode(_lowerCAmelCase)

				def 				__lowerCamelCase     (							self  :  Dict  ,       _lowerCAmelCase  :  T):







											'''simple docstring'''

											__lowercase       	=self.map[data]
											if elem_ref != elem_ref.parent:
																		__lowercase       	=self.find_set(elem_ref.parent.data)
											return elem_ref.parent

				def 				__lowerCamelCase     (							self  :  Any  ,       _lowerCAmelCase  :  DisjointSetTreeNode[T]  ,       _lowerCAmelCase  :  DisjointSetTreeNode[T]):







											'''simple docstring'''

											if nodea.rank > nodea.rank:
																		__lowercase       	=nodea
											else:
																		__lowercase       	=nodea
																		if nodea.rank == nodea.rank:
																									nodea.rank += 1

				def 				__lowerCamelCase     (							self  :  Dict  ,       _lowerCAmelCase  :  T  ,       _lowerCAmelCase  :  T):







											'''simple docstring'''

											self.link(self.find_set(_lowerCAmelCase)  ,       self.find_set(_lowerCAmelCase))





class _UpperCamelCase		(     Generic[T]		):





				'''simple docstring'''





				def __init__(							self  :  Optional[Any]):







											'''simple docstring'''

											__lowercase       	={}

				def 				__lowerCamelCase     (							self  :  Optional[int]  ,       _lowerCAmelCase  :  T):







											'''simple docstring'''

											if node not in self.connections:
																		__lowercase       	={}

				def 				__lowerCamelCase     (							self  :  Tuple  ,       _lowerCAmelCase  :  T  ,       _lowerCAmelCase  :  T  ,       _lowerCAmelCase  :  int):







											'''simple docstring'''

											self.add_node(_lowerCAmelCase)
											self.add_node(_lowerCAmelCase)
											__lowercase       	=weight
											__lowercase       	=weight

				def 				__lowerCamelCase     (							self  :  Tuple):







											'''simple docstring'''

											__lowercase       	=[]
											__lowercase       	=set()
											for start in self.connections:
																		for end in self.connections[start]:
																									if (start, end) not in seen:
																																seen.add((end, start))
																																edges.append((start, end, self.connections[start][end]))
											edges.sort(key=lambda _lowerCAmelCase: x[2])

											# creating the disjoint set
											__lowercase       	=DisjointSetTree[T]()
											for node in self.connections:
																		disjoint_set.make_set(_lowerCAmelCase)

											# MST generation
											__lowercase       	=0
											__lowercase       	=0
											__lowercase       	=GraphUndirectedWeighted[T]()
											while num_edges < len(self.connections) - 1:
																		__lowercase	,				__lowercase	,				__lowercase       	=edges[index]
																		index += 1
																		__lowercase       	=disjoint_set.find_set(_lowerCAmelCase)
																		__lowercase       	=disjoint_set.find_set(_lowerCAmelCase)
																		if parent_u != parent_v:
																									num_edges += 1
																									graph.add_edge(_lowerCAmelCase  ,       _lowerCAmelCase  ,       _lowerCAmelCase)
																									disjoint_set.union(_lowerCAmelCase  ,       _lowerCAmelCase)
											return graph








'''simple docstring'''



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



def   _A       (   _lowerCAmelCase					):



							"""simple docstring"""



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

							__lowercase       	=precision
							__lowercase       	=ceil(precision / 14					)
							__lowercase       	=426_880 * Decimal(10_005					).sqrt()
							__lowercase       	=1
							__lowercase       	=13_591_409
							__lowercase       	=Decimal(_lowerCAmelCase					)
							for k in range(1  ,   _lowerCAmelCase					):
														__lowercase       	=factorial(6 * k					) // (factorial(3 * k					) * factorial(_lowerCAmelCase					) ** 3)
														linear_term += 545_140_134
														exponential_term *= -262_537_412_640_768_000
														partial_sum += Decimal(multinomial_term * linear_term					) / exponential_term
							return str(constant_term / partial_sum					)[:-1]


if __name__ == "__main__":
		lowerCamelCase	 =       50
		print(f"The first {n} digits of pi is: {pi(n)}")



