
'''simple docstring'''




from math import factorial

lowercase			:				dict[str, int]    		=			{str(digit): factorial(digit) for digit in range(10)}







def 		lowerCAmelCase_				(   snake_case__						):




    '''simple docstring'''



    if not isinstance(snake_case__		,				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(snake_case__						)						)







def 		lowerCAmelCase_				(   snake_case__ = 60		,				snake_case__ = 100_0000						):




    '''simple docstring'''



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

    for start_chain_element in range(1		,				snake_case__						):
        # The temporary set will contain the elements of the chain
        A       :   int					=						set()
        A       :   List[Any]					=						0

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

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

        A       :   Dict					=						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'''




def 		lowerCAmelCase_				(   snake_case__ = 10						):




    '''simple docstring'''



    if not isinstance(snake_case__		,				snake_case__						) or n < 0:
        raise ValueError('''Invalid input'''						)
    A       :   List[str]					=						10**n
    A       :   Tuple					=						2_8433 * (pow(2		,				783_0457		,				snake_case__						)) + 1
    return str(number % modulus						)


if __name__ == "__main__":
      from doctest import testmod

      testmod()
      print(f'''{solution(10) = }''')




