






from typing import Dict

from .base import GenericTensor, Pipeline


class    _lowerCAmelCase			(		lowercase_      ):



				"""simple docstring"""



				def 					__magic_name__							(      self    :    List[Any]			,		UpperCamelCase__    :    str=None			,		UpperCamelCase__    :    List[Any]=None			,		UpperCamelCase__    :    List[Any]=None			,		**UpperCamelCase__    :    int):






											'''simple docstring'''







											if tokenize_kwargs is None:
																		snake_case__	  =       {}

											if truncation is not None:
																		if "truncation" in tokenize_kwargs:
																									raise ValueError(
																									    """truncation parameter defined twice (given as keyword argument as well as in tokenize_kwargs)""")
																		snake_case__	  =       truncation

											snake_case__	  =       tokenize_kwargs

											snake_case__	  =       {}
											if return_tensors is not None:
																		snake_case__	  =       return_tensors

											return preprocess_params, {}, postprocess_params



				def 					__magic_name__							(      self    :    List[str]			,		UpperCamelCase__    :    Dict			,		**UpperCamelCase__    :    int):






											'''simple docstring'''







											snake_case__	  =       self.framework
											snake_case__	  =       self.tokenizer(UpperCamelCase__			,		return_tensors=UpperCamelCase__			,		**UpperCamelCase__)
											return model_inputs



				def 					__magic_name__							(      self    :    List[str]			,		UpperCamelCase__    :    List[Any]):






											'''simple docstring'''







											snake_case__	  =       self.model(**UpperCamelCase__)
											return model_outputs



				def 					__magic_name__							(      self    :    Dict			,		UpperCamelCase__    :    Optional[int]			,		UpperCamelCase__    :    Union[str, Any]=False):






											'''simple docstring'''







											if return_tensors:
																		return model_outputs[0]
											if self.framework == "pt":
																		return model_outputs[0].tolist()
											elif self.framework == "tf":
																		return model_outputs[0].numpy().tolist()



				def __call__(      self    :    int			,		*UpperCamelCase__    :    Optional[Any]			,		**UpperCamelCase__    :    str):






											'''simple docstring'''







											return super().__call__(*UpperCamelCase__			,		**UpperCamelCase__)








from math import factorial

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

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

def _UpperCAmelCase   (	a						:	int = 60  ,					a						:	int = 100_0000 ):

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

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

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

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

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