'''simple docstring'''

from decimal import Decimal, getcontext
from math import ceil, factorial
def 			__UpperCamelCase       (   UpperCAmelCase     ):

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

 lowercase__				:    Any  =					precision
 lowercase__				:    Optional[int]  =					ceil(precision / 14     )
 lowercase__				:    Union[str, Any]  =					42_6880 * Decimal(1_0005     ).sqrt()
 lowercase__				:    int  =					1
 lowercase__				:    Union[str, Any]  =					1359_1409
 lowercase__				:    Dict  =					Decimal(snake_case__     )
 for k in range(1		,     snake_case__     ):
  lowercase__				:    List[str]  =					factorial(6 * k     ) // (factorial(3 * k     ) * factorial(snake_case__     ) ** 3)
  linear_term += 5_4514_0134
  exponential_term *= -26_2537_4126_4076_8000
  partial_sum += Decimal(multinomial_term * linear_term     ) / exponential_term
 return str(constant_term / partial_sum     )[:-1]


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






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


__UpperCAmelCase          =       {
    '''configuration_transfo_xl''': ['''TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TransfoXLConfig'''],
    '''tokenization_transfo_xl''': ['''TransfoXLCorpus''', '''TransfoXLTokenizer'''],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __UpperCAmelCase          =       [
        '''TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST''',
        '''AdaptiveEmbedding''',
        '''TransfoXLForSequenceClassification''',
        '''TransfoXLLMHeadModel''',
        '''TransfoXLModel''',
        '''TransfoXLPreTrainedModel''',
        '''load_tf_weights_in_transfo_xl''',
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __UpperCAmelCase          =       [
        '''TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST''',
        '''TFAdaptiveEmbedding''',
        '''TFTransfoXLForSequenceClassification''',
        '''TFTransfoXLLMHeadModel''',
        '''TFTransfoXLMainLayer''',
        '''TFTransfoXLModel''',
        '''TFTransfoXLPreTrainedModel''',
    ]


if TYPE_CHECKING:
    from .configuration_transfo_xl import TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP, TransfoXLConfig
    from .tokenization_transfo_xl import TransfoXLCorpus, TransfoXLTokenizer

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_transfo_xl import (
            TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST,
            AdaptiveEmbedding,
            TransfoXLForSequenceClassification,
            TransfoXLLMHeadModel,
            TransfoXLModel,
            TransfoXLPreTrainedModel,
            load_tf_weights_in_transfo_xl,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_transfo_xl import (
            TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFAdaptiveEmbedding,
            TFTransfoXLForSequenceClassification,
            TFTransfoXLLMHeadModel,
            TFTransfoXLMainLayer,
            TFTransfoXLModel,
            TFTransfoXLPreTrainedModel,
        )

else:
    import sys

    __UpperCAmelCase          =       _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



