





'''simple docstring'''




__UpperCAmelCase			    =    {
    """joule""": 1.0,
    """kilojoule""": 1000,
    """megajoule""": 1000000,
    """gigajoule""": 1000000000,
    """wattsecond""": 1.0,
    """watthour""": 3600,
    """kilowatthour""": 3600000,
    """newtonmeter""": 1.0,
    """calorie_nutr""": 4186.8,
    """kilocalorie_nutr""": 4186800.00,
    """electronvolt""": 1.602176634e-19,
    """britishthermalunit_it""": 1055.05585,
    """footpound""": 1.355818,
}



def 						__A						(   lowerCamelCase_       ,       lowerCamelCase_       ,       lowerCamelCase_     ):


		"""simple docstring"""



		if to_type not in ENERGY_CONVERSION or from_type not in ENERGY_CONVERSION:
				SCREAMING_SNAKE_CASE      :							str						=       (
				    f'''Incorrect \'from_type\' or \'to_type\' value: {from_type!r}, {to_type!r}\n'''
				    f'''Valid values are: {", ".join(_UpperCamelCase     )}'''
				)
				raise ValueError(_UpperCamelCase     )
		return value * ENERGY_CONVERSION[from_type] / ENERGY_CONVERSION[to_type]


if __name__ == "__main__":
							import doctest

							doctest.testmod()










from math import factorial

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






def      lowerCamelCase_						(				_UpperCamelCase )		->						int:






				"""simple docstring"""


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






def      lowerCamelCase_						(				_UpperCamelCase = 60 ,				_UpperCamelCase = 1_000_000 )		->						int:






				"""simple docstring"""


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

				for start_chain_element in range(1 ,				_UpperCamelCase ):
								# The temporary set will contain the elements of the chain
								snake_case_						:    List[str]				=  set()
								snake_case_						:    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.
								snake_case_						:    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(_UpperCamelCase )
												chain_set_length += 1
												snake_case_						:    List[Any]				=  digit_factorial_sum(_UpperCamelCase )

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

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