"""simple docstring"""







import importlib.metadata
from typing import Union

from packaging.version import Version, parse

from .constants import STR_OPERATION_TO_FUNC


SCREAMING_SNAKE_CASE									=						parse(importlib.metadata.version('torch'))


def      __lowerCAmelCase(		__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			):






	"""simple docstring"""





	if operation not in STR_OPERATION_TO_FUNC.keys():
		raise ValueError(F'''`operation` must be one of {list(STR_OPERATION_TO_FUNC.keys()			)}, received {operation}'''			)
	_lowercase :    List[str]							=							STR_OPERATION_TO_FUNC[operation]
	if isinstance(__UpperCAmelCase     ,__UpperCAmelCase			):
		_lowercase :    Dict							=							parse(importlib.metadata.version(__UpperCAmelCase			)			)
	return operation(__UpperCAmelCase     ,parse(__UpperCAmelCase			)			)







def      __lowerCAmelCase(		__UpperCAmelCase     ,__UpperCAmelCase			):






	"""simple docstring"""





	return compare_versions(__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			)




"""simple docstring"""







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


def      __lowerCAmelCase(		__UpperCAmelCase			):






	"""simple docstring"""





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

	_lowercase :    Optional[Any]							=							precision
	_lowercase :    Dict							=							ceil(precision / 14			)
	_lowercase :    int							=							426_880 * Decimal(10_005			).sqrt()
	_lowercase :    Optional[Any]							=							1
	_lowercase :    Union[str, Any]							=							13_591_409
	_lowercase :    Optional[int]							=							Decimal(__UpperCAmelCase			)
	for k in range(1     ,__UpperCAmelCase			):
		_lowercase :    List[str]							=							factorial(6 * k			) // (factorial(3 * k			) * factorial(__UpperCAmelCase			) ** 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__":
						SCREAMING_SNAKE_CASE									=						50
						print(f"""The first {n} digits of pi is: {pi(n)}""")



