






from math import factorial

UpperCamelCase								=		{str(digit): factorial(digit) for digit in range(10)}






def    __magic_name__    (	SCREAMING_SNAKE_CASE				)     ->    int:
							if not isinstance(SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE				):
														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(SCREAMING_SNAKE_CASE				)				)






def    __magic_name__    (	SCREAMING_SNAKE_CASE = 60     ,     SCREAMING_SNAKE_CASE = 1_000_000				)     ->    int:

							if not isinstance(SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE				) or not isinstance(SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE				):
														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
							_lowercase							:   Tuple 							=   0
							# the cached sizes of the previous chains
							_lowercase							:   dict[int, int] 							=   {}

							for start_chain_element in range(1     ,     SCREAMING_SNAKE_CASE				):
														# The temporary set will contain the elements of the chain
														_lowercase							:   Dict 							=   set()
														_lowercase							:   Union[str, Any] 							=   0

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

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

														_lowercase							:   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()}''')






"""simple docstring"""
from typing import List

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


SCREAMING_SNAKE_CASE_					     =	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_					     =	{
    '''snap-research/efficientformer-l1-300''': (
        '''https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json'''
    ),
}
class       lowerCAmelCase_		(				A__ ):



							'''simple docstring'''





							_snake_case						      =		'''efficientformer'''




							def __init__( self    ,				snake_case_ = [3, 2, 6, 4]    ,				snake_case_ = [48, 96, 224, 448]    ,				snake_case_ = [True, True, True, True]    ,				snake_case_ = 448    ,				snake_case_ = 32    ,				snake_case_ = 4    ,				snake_case_ = 7    ,				snake_case_ = 5    ,				snake_case_ = 8    ,				snake_case_ = 4    ,				snake_case_ = 0.0    ,				snake_case_ = 16    ,				snake_case_ = 3    ,				snake_case_ = 3    ,				snake_case_ = 3    ,				snake_case_ = 2    ,				snake_case_ = 1    ,				snake_case_ = 0.0    ,				snake_case_ = 1    ,				snake_case_ = True    ,				snake_case_ = True    ,				snake_case_ = 1e-5    ,				snake_case_ = "gelu"    ,				snake_case_ = 0.02    ,				snake_case_ = 1e-1_2    ,				snake_case_ = 224    ,				snake_case_ = 1e-0_5    ,				**snake_case_    ,				)       ->  None:
													super().__init__(**snake_case_				)

													__lowerCAmelCase     =  hidden_act
													__lowerCAmelCase     =  hidden_dropout_prob
													__lowerCAmelCase     =  hidden_sizes
													__lowerCAmelCase     =  num_hidden_layers
													__lowerCAmelCase     =  num_attention_heads
													__lowerCAmelCase     =  initializer_range
													__lowerCAmelCase     =  layer_norm_eps
													__lowerCAmelCase     =  patch_size
													__lowerCAmelCase     =  num_channels
													__lowerCAmelCase     =  depths
													__lowerCAmelCase     =  mlp_expansion_ratio
													__lowerCAmelCase     =  downsamples
													__lowerCAmelCase     =  dim
													__lowerCAmelCase     =  key_dim
													__lowerCAmelCase     =  attention_ratio
													__lowerCAmelCase     =  resolution
													__lowerCAmelCase     =  pool_size
													__lowerCAmelCase     =  downsample_patch_size
													__lowerCAmelCase     =  downsample_stride
													__lowerCAmelCase     =  downsample_pad
													__lowerCAmelCase     =  drop_path_rate
													__lowerCAmelCase     =  num_metaad_blocks
													__lowerCAmelCase     =  distillation
													__lowerCAmelCase     =  use_layer_scale
													__lowerCAmelCase     =  layer_scale_init_value
													__lowerCAmelCase     =  image_size
													__lowerCAmelCase     =  batch_norm_eps
