

from math import factorial

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






def 					lowerCamelCase_     (							UpperCAmelCase_							:     int	)						->				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_							:     int = 6_0							,       UpperCAmelCase_							:     int = 1_0_0_0_0_0_0	)						->				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
	_UpperCamelCase   :		str			=						0
	# the cached sizes of the previous chains
	_UpperCamelCase   :		dict[int, int]			=						{}

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

		# Stop computing the chain when you find a cached size, a repeating item or the
		# length is greater then the desired one.
		_UpperCamelCase   :		int			=						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
			_UpperCamelCase   :		Optional[int]			=						digit_factorial_sum(UpperCAmelCase_	)

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

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









def 					lowerCamelCase_     (							UpperCAmelCase_							:     list	)						->				list:




	'''simple docstring'''




	if len(UpperCAmelCase_	) <= 1:
		return [tuple(UpperCAmelCase_	)]

	_UpperCamelCase   :		List[Any]			=						[]

	def generate(UpperCAmelCase_							:     int							,       UpperCAmelCase_							:     list	):
		_UpperCamelCase   :		Optional[int]			=						[0] * n
		res.append(tuple(UpperCAmelCase_	)	)

		_UpperCamelCase   :		List[Any]			=						0
		while i < n:
			if c[i] < i:
				if i % 2 == 0:
					_UpperCamelCase	,		_UpperCamelCase   :		List[str]			=						arr[i], arr[0]
				else:
					_UpperCamelCase	,		_UpperCamelCase   :		List[str]			=						arr[i], arr[c[i]]
				res.append(tuple(UpperCAmelCase_	)	)
				c[i] += 1
				_UpperCamelCase   :		Tuple			=						0
			else:
				_UpperCamelCase   :		Tuple			=						0
				i += 1

	generate(len(UpperCAmelCase_	)							,       UpperCAmelCase_	)
	return res


if __name__ == "__main__":
							lowerCAmelCase__								=		input("""Enter numbers separated by a comma:\n""").strip()
							lowerCAmelCase__								=		[int(item) for item in user_input.split(""",""")]
							print(heaps(arr))




