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






def 				__lowerCamelCase		(						lowerCAmelCase__     ):

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

       lowerCAmelCase__					     = precision
       lowerCAmelCase__					     = ceil(precision / 1_4     )
       lowerCAmelCase__					     = 4_2_6_8_8_0 * Decimal(1_0_0_0_5     ).sqrt()
       lowerCAmelCase__					     = 1
       lowerCAmelCase__					     = 1_3_5_9_1_4_0_9
       lowerCAmelCase__					     = Decimal(lowerCAmelCase__     )
       for k in range(1     ,  lowerCAmelCase__     ):
              lowerCAmelCase__					     = factorial(6 * k     ) // (factorial(3 * k     ) * factorial(lowerCAmelCase__     ) ** 3)
              linear_term += 5_4_5_1_4_0_1_3_4
              exponential_term *= -2_6_2_5_3_7_4_1_2_6_4_0_7_6_8_0_0_0
              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)}')

from typing import TYPE_CHECKING

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


lowerCAmelCase__     						=			{
    '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:
    lowerCAmelCase__     						=			[
        '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:
    lowerCAmelCase__     						=			[
        '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

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