






"""simple docstring"""







from math import factorial

lowerCAmelCase_	:    dict[str, int]            =      {str(digit): factorial(digit) for digit in range(1_0)}






def       _lowerCAmelCase       (      lowerCAmelCase		):







       '''simple docstring'''
       if not isinstance(lowerCAmelCase	,      lowerCAmelCase		):
              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(lowerCAmelCase		)		)






def       _lowerCAmelCase       (      lowerCAmelCase = 60	,      lowerCAmelCase = 1000000		):







       '''simple docstring'''

       if not isinstance(lowerCAmelCase	,      lowerCAmelCase		) or not isinstance(lowerCAmelCase	,      lowerCAmelCase		):
              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	    =			0
       # the cached sizes of the previous chains
       UpperCAmelCase	    =			{}

       for start_chain_element in range(1	,      lowerCAmelCase		):
              # The temporary set will contain the elements of the chain
              UpperCAmelCase	    =			set()
              UpperCAmelCase	    =			0

              # Stop computing the chain when you find a cached size, a repeating item or the
              # length is greater then the desired one.
              UpperCAmelCase	    =			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(lowerCAmelCase		)
                     chain_set_length += 1
                     UpperCAmelCase	    =			digit_factorial_sum(lowerCAmelCase		)

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

              UpperCAmelCase	    =			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()}')








"""simple docstring"""







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


lowerCAmelCase_	:    Any            =      logging.get_logger(__name__)

lowerCAmelCase_	:    Any            =      {
    '''google/canine-s''': '''https://huggingface.co/google/canine-s/resolve/main/config.json''',
    # See all CANINE models at https://huggingface.co/models?filter=canine
}





class   UpperCamelCase_ (       a_  ):
  _A       :					Tuple				=	'canine'



  def __init__(      self ,		snake_case__=7_68 ,		snake_case__=12 ,		snake_case__=12 ,		snake_case__=30_72 ,		snake_case__="gelu" ,		snake_case__=0.1 ,		snake_case__=0.1 ,		snake_case__=1_63_84 ,		snake_case__=16 ,		snake_case__=0.02 ,		snake_case__=1e-12 ,		snake_case__=0 ,		snake_case__=0xE_0_0_0 ,		snake_case__=0xE_0_0_1 ,		snake_case__=4 ,		snake_case__=4 ,		snake_case__=8 ,		snake_case__=1_63_84 ,		snake_case__=1_28 ,		**snake_case__ ,		)			->			int:



         """simple docstring"""





         super().__init__(pad_token_id=snake_case__ ,		bos_token_id=snake_case__ ,		eos_token_id=snake_case__ ,		**snake_case__				)

         UpperCAmelCase	    =			max_position_embeddings
         UpperCAmelCase	    =			hidden_size
         UpperCAmelCase	    =			num_hidden_layers
         UpperCAmelCase	    =			num_attention_heads
         UpperCAmelCase	    =			intermediate_size
         UpperCAmelCase	    =			hidden_act
         UpperCAmelCase	    =			hidden_dropout_prob
         UpperCAmelCase	    =			attention_probs_dropout_prob
         UpperCAmelCase	    =			initializer_range
         UpperCAmelCase	    =			type_vocab_size
         UpperCAmelCase	    =			layer_norm_eps

         # Character config:
         UpperCAmelCase	    =			downsampling_rate
         UpperCAmelCase	    =			upsampling_kernel_size
         UpperCAmelCase	    =			num_hash_functions
         UpperCAmelCase	    =			num_hash_buckets
         UpperCAmelCase	    =			local_transformer_stride
