






import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding


class    _lowerCAmelCase			(		lowercase_		):



				"""simple docstring"""



				_lowercase				:   str      =  ['''image_processor''', '''tokenizer''']
				_lowercase				:   Optional[int]      =  '''ViTImageProcessor'''
				_lowercase				:   str      =  ('''CLIPTokenizer''', '''CLIPTokenizerFast''')



				def __init__(      self    :    Any			,		UpperCamelCase__    :    List[Any]=None			,		UpperCamelCase__    :    Tuple=None			,		**UpperCamelCase__    :    Optional[int]):






											'''simple docstring'''







											snake_case__	  =       None
											if "feature_extractor" in kwargs:
																		warnings.warn(
																		    """The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"""
																		    """ instead."""			,		UpperCamelCase__			,		)
																		snake_case__	  =       kwargs.pop("""feature_extractor""")

											snake_case__	  =       image_processor if image_processor is not None else feature_extractor
											if image_processor is None:
																		raise ValueError("""You need to specify an `image_processor`.""")
											if tokenizer is None:
																		raise ValueError("""You need to specify a `tokenizer`.""")

											super().__init__(UpperCamelCase__			,		UpperCamelCase__)



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






											'''simple docstring'''







											if text is None and visual_prompt is None and images is None:
																		raise ValueError("""You have to specify either text, visual prompt or images.""")

											if text is not None and visual_prompt is not None:
																		raise ValueError("""You have to specify exactly one type of prompt. Either text or visual prompt.""")

											if text is not None:
																		snake_case__	  =       self.tokenizer(UpperCamelCase__			,		return_tensors=UpperCamelCase__			,		**UpperCamelCase__)

											if visual_prompt is not None:
																		snake_case__	  =       self.image_processor(UpperCamelCase__			,		return_tensors=UpperCamelCase__			,		**UpperCamelCase__)

											if images is not None:
																		snake_case__	  =       self.image_processor(UpperCamelCase__			,		return_tensors=UpperCamelCase__			,		**UpperCamelCase__)

											if visual_prompt is not None and images is not None:
																		snake_case__	  =       {
																		    """pixel_values""": image_features.pixel_values,
																		    """conditional_pixel_values""": prompt_features.pixel_values,
																		}
																		return encoding
											elif text is not None and images is not None:
																		snake_case__	  =       image_features.pixel_values
																		return encoding
											elif text is not None:
																		return encoding
											elif visual_prompt is not None:
																		snake_case__	  =       {
																		    """conditional_pixel_values""": prompt_features.pixel_values,
																		}
																		return encoding
											else:
																		return BatchEncoding(data=dict(**UpperCamelCase__)			,		tensor_type=UpperCamelCase__)



				def 					__magic_name__							(      self    :    str			,		*UpperCamelCase__    :    Tuple			,		**UpperCamelCase__    :    Optional[Any]):






											'''simple docstring'''







											return self.tokenizer.batch_decode(*UpperCamelCase__			,		**UpperCamelCase__)



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






											'''simple docstring'''







											return self.tokenizer.decode(*UpperCamelCase__			,		**UpperCamelCase__)



				@property
				def 					__magic_name__							(      self    :    int):






											'''simple docstring'''







											warnings.warn(
											    """`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."""			,		UpperCamelCase__			,		)
											return self.image_processor_class



				@property
				def 					__magic_name__							(      self    :    Optional[Any]):






											'''simple docstring'''







											warnings.warn(
											    """`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."""			,		UpperCamelCase__			,		)
											return self.image_processor








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