





"""simple docstring"""


from ...configuration_utils import PretrainedConfig
from ...utils import logging


__magic_name__       :					Union[str, Any]						=			logging.get_logger(__name__)

__magic_name__       :					List[Any]						=			{
    # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert
}






class 							lowercase__			(   __SCREAMING_SNAKE_CASE	):

			"""simple docstring"""
			__lowerCAmelCase     :				Any										=  """megatron-bert"""







			def __init__(      self						,   _A=2_9_0_5_6						,   _A=1_0_2_4						,   _A=2_4						,   _A=1_6						,   _A=4_0_9_6						,   _A="gelu"						,   _A=0.1						,   _A=0.1						,   _A=5_1_2						,   _A=2						,   _A=0.02						,   _A=1e-1_2						,   _A=0						,   _A="absolute"						,   _A=True						,   **_A						,   ):






									'''simple docstring'''







									super().__init__(pad_token_id=_A						,   **_A    )

									UpperCamelCase				:		int				   =			vocab_size
									UpperCamelCase				:		int				   =			hidden_size
									UpperCamelCase				:		Tuple				   =			num_hidden_layers
									UpperCamelCase				:		Tuple				   =			num_attention_heads
									UpperCamelCase				:		Any				   =			hidden_act
									UpperCamelCase				:		Dict				   =			intermediate_size
									UpperCamelCase				:		Union[str, Any]				   =			hidden_dropout_prob
									UpperCamelCase				:		List[Any]				   =			attention_probs_dropout_prob
									UpperCamelCase				:		Union[str, Any]				   =			max_position_embeddings
									UpperCamelCase				:		int				   =			type_vocab_size
									UpperCamelCase				:		List[Any]				   =			initializer_range
									UpperCamelCase				:		Union[str, Any]				   =			layer_norm_eps
									UpperCamelCase				:		Optional[int]				   =			position_embedding_type
									UpperCamelCase				:		int				   =			use_cache





'''simple docstring'''





from math import factorial

SCREAMING_SNAKE_CASE     =       {str(digit): factorial(digit) for digit in range(1_0)}







def snake_case_     (					lowercase__		):
  if not isinstance(lowercase__   ,       lowercase__		):
    raise TypeError("Parameter number must be int"		)

  if number < 0:
    raise ValueError("Parameter number must be greater than or equal to 0"		)

  # Converts number in string to iterate on its digits and adds its factorial.
  return sum(DIGIT_FACTORIAL[digit] for digit in str(lowercase__		)		)







def snake_case_     (					lowercase__ = 6_0   ,       lowercase__ = 1_0_0_0_0_0_0		):

  if not isinstance(lowercase__   ,       lowercase__		) or not isinstance(lowercase__   ,       lowercase__		):
    raise TypeError("Parameters chain_length and number_limit must be int"		)

  if chain_length <= 0 or number_limit <= 0:
    raise ValueError(
        "Parameters chain_length and number_limit must be greater than 0"		)

  # the counter for the chains with the exact desired length
  UpperCAmelCase__      :					Union[str, Any]				       =							0
  # the cached sizes of the previous chains
  UpperCAmelCase__      :					dict[int, int]				       =							{}

  for start_chain_element in range(1   ,       lowercase__		):
    # The temporary set will contain the elements of the chain
    UpperCAmelCase__      :					Any				       =							set()
    UpperCAmelCase__      :					int				       =							0

    # Stop computing the chain when you find a cached size, a repeating item or the
    # length is greater then the desired one.
    UpperCAmelCase__      :					List[str]				       =							start_chain_element
    while (
        chain_element not in chain_sets_lengths
        and chain_element not in chain_set
        and chain_set_length <= chain_length
    ):
      chain_set.add(lowercase__		)
      chain_set_length += 1
      UpperCAmelCase__      :					List[str]				       =							digit_factorial_sum(lowercase__		)

    if chain_element in chain_sets_lengths:
      chain_set_length += chain_sets_lengths[chain_element]

    UpperCAmelCase__      :					List[str]				       =							chain_set_length

    # If chain contains the exact amount of elements increase the counter
    if chain_set_length == chain_length:
      chains_counter += 1

  return chains_counter


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      print(F'{solution()}')



