'''simple docstring'''



import warnings

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






class 	UpperCamelCase__(       lowerCAmelCase	):
				__magic_name__    :				Tuple  		=	["image_processor", "tokenizer"]
				__magic_name__    :				Any  		=	"CLIPImageProcessor"
				__magic_name__    :				Optional[Any]  		=	("CLIPTokenizer", "CLIPTokenizerFast")




				def __init__(		self      :			Union[str, Any]				,   lowerCAmelCase      :			Tuple=None				,   lowerCAmelCase      :			Any=None				,   **lowerCAmelCase      :			Dict				)->					Tuple:

										"""simple docstring"""




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

										UpperCAmelCase					    =     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__(lowerCAmelCase				,   lowerCAmelCase				)




				def __call__(		self      :			Tuple				,   lowerCAmelCase      :			List[Any]=None				,   lowerCAmelCase      :			List[str]=None				,   lowerCAmelCase      :			str=None				,   **lowerCAmelCase      :			List[Any]				)->					int:

										"""simple docstring"""




										if text is None and images is None:
																raise ValueError('''You have to specify either text or images. Both cannot be none.'''				)

										if text is not None:
																UpperCAmelCase					    =     self.tokenizer(lowerCAmelCase				,   return_tensors=lowerCAmelCase				,   **lowerCAmelCase				)

										if images is not None:
																UpperCAmelCase					    =     self.image_processor(lowerCAmelCase				,   return_tensors=lowerCAmelCase				,   **lowerCAmelCase				)

										if text is not None and images is not None:
																UpperCAmelCase					    =     image_features.pixel_values
																return encoding
										elif text is not None:
																return encoding
										else:
																return BatchEncoding(data=dict(**lowerCAmelCase				)				,   tensor_type=lowerCAmelCase				)




				def 					a__(		self      :			Union[str, Any]				,   *lowerCAmelCase      :			Union[str, Any]				,   **lowerCAmelCase      :			Optional[Any]				)->					Dict:

										"""simple docstring"""




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




				def 					a__(		self      :			List[Any]				,   *lowerCAmelCase      :			List[str]				,   **lowerCAmelCase      :			Optional[int]				)->					int:

										"""simple docstring"""




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




				@property
				def 					a__(		self      :			Any				)->					Any:

										"""simple docstring"""




										UpperCAmelCase					    =     self.tokenizer.model_input_names
										UpperCAmelCase					    =     self.image_processor.model_input_names
										return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names				)				)




				@property
				def 					a__(		self      :			Union[str, Any]				)->					str:

										"""simple docstring"""




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





				@property
				def 					a__(		self      :			Optional[int]				)->					List[Any]:

										"""simple docstring"""




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









'''simple docstring'''



_lowercase      :      Any            =					range(2, 20 + 1)
_lowercase      :      str            =					[10**k for k in range(ks[-1] + 1)]
_lowercase      :      dict[int, dict[int, list[list[int]]]]            =					{}


def 				lowerCamelCase__				(	A       :      int				,       A       :      str				,       A       :      List[Any]				,       A       :      Union[str, Any]					):




						'''simple docstring'''






						UpperCAmelCase					    =     sum(a_i[j] for j in range(A				,       len(A					)					)					)
						UpperCAmelCase					    =     sum(a_i[j] * base[j] for j in range(min(len(A					)				,       A					)					)					)

						UpperCAmelCase    ,    UpperCAmelCase					    =     0, 0
						UpperCAmelCase					    =     n - i

						UpperCAmelCase					    =     memo.get(A					)

						if sub_memo is not None:
												UpperCAmelCase					    =     sub_memo.get(A					)

												if jumps is not None and len(A					) > 0:
																		# find and make the largest jump without going over
																		UpperCAmelCase					    =     -1
																		for _k in range(len(A					) - 1				,       -1				,       -1					):
																								if jumps[_k][2] <= k and jumps[_k][1] <= max_dn:
																														UpperCAmelCase					    =     _k
																														break

																		if max_jump >= 0:
																								UpperCAmelCase    ,    UpperCAmelCase    ,    UpperCAmelCase					    =     jumps[max_jump]
																								# since the difference between jumps is cached, add c
																								UpperCAmelCase					    =     diff + c
																								for j in range(min(A				,       len(A					)					)					):
																														UpperCAmelCase    ,    UpperCAmelCase					    =     divmod(A				,       10					)
																								if new_c > 0:
																														add(A				,       A				,       A					)

												else:
																		UpperCAmelCase					    =     []
						else:
												UpperCAmelCase					    =     {c: []}
												UpperCAmelCase					    =     sub_memo

						if dn >= max_dn or c + diff >= base[k]:
												return diff, dn

						if k > ks[0]:
												while True:
																		# keep doing smaller jumps
																		UpperCAmelCase    ,    UpperCAmelCase					    =     next_term(A				,       k - 1				,       i + dn				,       A					)
																		diff += _diff
																		dn += terms_jumped

																		if dn >= max_dn or c + diff >= base[k]:
																								break
						else:
												# would be too small a jump, just compute sequential terms instead
												UpperCAmelCase    ,    UpperCAmelCase					    =     compute(A				,       A				,       i + dn				,       A					)
												diff += _diff
												dn += terms_jumped

						UpperCAmelCase					    =     sub_memo[c]

						# keep jumps sorted by # of terms skipped
						UpperCAmelCase					    =     0
						while j < len(A					):
												if jumps[j][1] > dn:
																		break
												j += 1

						# cache the jump for this value digitsum(b) and c
						sub_memo[c].insert(A				,       (diff, dn, k)					)
						return (diff, dn)


def 				lowerCamelCase__				(	A       :      Dict				,       A       :      Optional[int]				,       A       :      List[Any]				,       A       :      int					):




						'''simple docstring'''






						if i >= n:
												return 0, i
						if k > len(A					):
												a_i.extend([0 for _ in range(k - len(A					)					)]					)

						# note: a_i -> b * 10^k + c
						# ds_b -> digitsum(b)
						# ds_c -> digitsum(c)
						UpperCAmelCase					    =     i
						UpperCAmelCase    ,    UpperCAmelCase    ,    UpperCAmelCase					    =     0, 0, 0
						for j in range(len(A					)					):
												if j >= k:
																		ds_b += a_i[j]
												else:
																		ds_c += a_i[j]

						while i < n:
												i += 1
												UpperCAmelCase					    =     ds_c + ds_b
												diff += addend
												UpperCAmelCase					    =     0
												for j in range(A					):
																		UpperCAmelCase					    =     a_i[j] + addend
																		UpperCAmelCase    ,    UpperCAmelCase					    =     divmod(A				,       10					)

																		ds_c += a_i[j]

												if addend > 0:
																		break

						if addend > 0:
												add(A				,       A				,       A					)
						return diff, i - start_i


def 				lowerCamelCase__				(	A       :      List[str]				,       A       :      Optional[int]				,       A       :      Optional[Any]					):




						'''simple docstring'''






						for j in range(A				,       len(A					)					):
												UpperCAmelCase					    =     digits[j] + addend
												if s >= 10:
																		UpperCAmelCase    ,    UpperCAmelCase					    =     divmod(A				,       10					)
																		UpperCAmelCase					    =     addend // 10 + quotient
												else:
																		UpperCAmelCase					    =     s
																		UpperCAmelCase					    =     addend // 10

												if addend == 0:
																		break

						while addend > 0:
												UpperCAmelCase    ,    UpperCAmelCase					    =     divmod(A				,       10					)
												digits.append(A					)


def 				lowerCamelCase__				(	A       :      int = 10**15					):




						'''simple docstring'''






						UpperCAmelCase					    =     [1]
						UpperCAmelCase					    =     1
						UpperCAmelCase					    =     0
						while True:
												UpperCAmelCase    ,    UpperCAmelCase					    =     next_term(A				,       20				,       i + dn				,       A					)
												dn += terms_jumped
												if dn == n - i:
																		break

						UpperCAmelCase					    =     0
						for j in range(len(A					)					):
												a_n += digits[j] * 10**j
						return a_n


if __name__ == "__main__":
	print(F"""{solution() = }""")





