
__snake_case								=  range(2, 20 + 1)
__snake_case								=  [10**k for k in range(ks[-1] + 1)]
__snake_case								=  {}






def 							_lowercase							(     UpperCamelCase_	,	UpperCamelCase_	,	UpperCamelCase_	,	UpperCamelCase_		)		->		Union[str, Any]:
					'''simple docstring'''


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

					SCREAMING_SNAKE_CASE__						, SCREAMING_SNAKE_CASE__													= 0, 0
					SCREAMING_SNAKE_CASE__													= n - i

					SCREAMING_SNAKE_CASE__													= memo.get(UpperCamelCase_		)

					if sub_memo is not None:
										SCREAMING_SNAKE_CASE__													= sub_memo.get(UpperCamelCase_		)

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

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

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

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

					if k > ks[0]:
										while True:
															# keep doing smaller jumps
															SCREAMING_SNAKE_CASE__						, SCREAMING_SNAKE_CASE__													= next_term(UpperCamelCase_	,	k - 1	,	i + dn	,	UpperCamelCase_		)
															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
										SCREAMING_SNAKE_CASE__						, SCREAMING_SNAKE_CASE__													= compute(UpperCamelCase_	,	UpperCamelCase_	,	i + dn	,	UpperCamelCase_		)
										diff += _diff
										dn += terms_jumped

					SCREAMING_SNAKE_CASE__													= sub_memo[c]

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

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






def 							_lowercase							(     UpperCamelCase_	,	UpperCamelCase_	,	UpperCamelCase_	,	UpperCamelCase_		)		->		Tuple:
					'''simple docstring'''


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

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

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

															ds_c += a_i[j]

										if addend > 0:
															break

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






def 							_lowercase							(     UpperCamelCase_	,	UpperCamelCase_	,	UpperCamelCase_		)		->		Dict:
					'''simple docstring'''


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

										if addend == 0:
															break

					while addend > 0:
										SCREAMING_SNAKE_CASE__						, SCREAMING_SNAKE_CASE__													= divmod(UpperCamelCase_	,	10		)
										digits.append(UpperCamelCase_		)






def 							_lowercase							(     UpperCamelCase_ = 10**15		)		->		int:
					'''simple docstring'''


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

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


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







import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin
from .feature_extraction_wavaveca import WavaVecaFeatureExtractor
from .tokenization_wavaveca import WavaVecaCTCTokenizer




class 						lowercase__  (						_UpperCAmelCase  ):
	A__    :   Union[str, Any]				       ="""Wav2Vec2FeatureExtractor"""
	A__    :   Any				       ="""AutoTokenizer"""
	def __init__(			self							:   List[Any]       ,   UpperCAmelCase_							:   List[str]       ,   UpperCAmelCase_							:   str							):
						super().__init__(UpperCAmelCase_       ,   UpperCAmelCase_							)
						SCREAMING_SNAKE_CASE__													= self.feature_extractor
						SCREAMING_SNAKE_CASE__													= False
	@classmethod
	def      A_				(			cls							:   Union[str, Any]       ,   UpperCAmelCase_							:   Any       ,   **UpperCAmelCase_							:   Optional[Any]							):
						try:
											return super().from_pretrained(UpperCAmelCase_       ,   **UpperCAmelCase_							)
						except OSError:
											warnings.warn(
											    F'Loading a tokenizer inside {cls.__name__} from a config that does not'
											    ' include a `tokenizer_class` attribute is deprecated and will be '
											    'removed in v5. Please add `\'tokenizer_class\': \'Wav2Vec2CTCTokenizer\'`'
											    ' attribute to either your `config.json` or `tokenizer_config.json` '
											    'file to suppress this warning: '       ,   UpperCAmelCase_       ,   )

											SCREAMING_SNAKE_CASE__													= WavaVecaFeatureExtractor.from_pretrained(UpperCAmelCase_       ,   **UpperCAmelCase_							)
											SCREAMING_SNAKE_CASE__													= WavaVecaCTCTokenizer.from_pretrained(UpperCAmelCase_       ,   **UpperCAmelCase_							)

											return cls(feature_extractor=UpperCAmelCase_       ,   tokenizer=UpperCAmelCase_							)
	def __call__(			self							:   Any       ,   *UpperCAmelCase_							:   Dict       ,   **UpperCAmelCase_							:   Any							):
						# For backward compatibility
						if self._in_target_context_manager:
											return self.current_processor(*UpperCAmelCase_       ,   **UpperCAmelCase_							)

						if "raw_speech" in kwargs:
											warnings.warn('Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead.'							)
											SCREAMING_SNAKE_CASE__													= kwargs.pop('raw_speech'							)
						else:
											SCREAMING_SNAKE_CASE__													= kwargs.pop('audio'       ,   UpperCAmelCase_							)
						SCREAMING_SNAKE_CASE__													= kwargs.pop('sampling_rate'       ,   UpperCAmelCase_							)
						SCREAMING_SNAKE_CASE__													= kwargs.pop('text'       ,   UpperCAmelCase_							)
						if len(UpperCAmelCase_							) > 0:
											SCREAMING_SNAKE_CASE__													= args[0]
											SCREAMING_SNAKE_CASE__													= args[1:]

						if audio is None and text is None:
											raise ValueError('You need to specify either an `audio` or `text` input to process.'							)

						if audio is not None:
											SCREAMING_SNAKE_CASE__													= self.feature_extractor(UpperCAmelCase_       ,   *UpperCAmelCase_       ,   sampling_rate=UpperCAmelCase_       ,   **UpperCAmelCase_							)
						if text is not None:
											SCREAMING_SNAKE_CASE__													= self.tokenizer(UpperCAmelCase_       ,   **UpperCAmelCase_							)

						if text is None:
											return inputs
						elif audio is None:
											return encodings
						else:
											SCREAMING_SNAKE_CASE__													= encodings['input_ids']
											return inputs
	def      A_				(			self							:   List[str]       ,   *UpperCAmelCase_							:   List[Any]       ,   **UpperCAmelCase_							:   Optional[int]							):
						# For backward compatibility
						if self._in_target_context_manager:
											return self.current_processor.pad(*UpperCAmelCase_       ,   **UpperCAmelCase_							)

						SCREAMING_SNAKE_CASE__													= kwargs.pop('input_features'       ,   UpperCAmelCase_							)
						SCREAMING_SNAKE_CASE__													= kwargs.pop('labels'       ,   UpperCAmelCase_							)
						if len(UpperCAmelCase_							) > 0:
											SCREAMING_SNAKE_CASE__													= args[0]
											SCREAMING_SNAKE_CASE__													= args[1:]

						if input_features is not None:
											SCREAMING_SNAKE_CASE__													= self.feature_extractor.pad(UpperCAmelCase_       ,   *UpperCAmelCase_       ,   **UpperCAmelCase_							)
						if labels is not None:
											SCREAMING_SNAKE_CASE__													= self.tokenizer.pad(UpperCAmelCase_       ,   **UpperCAmelCase_							)

						if labels is None:
											return input_features
						elif input_features is None:
											return labels
						else:
											SCREAMING_SNAKE_CASE__													= labels['input_ids']
											return input_features
	def      A_				(			self							:   List[Any]       ,   *UpperCAmelCase_							:   List[str]       ,   **UpperCAmelCase_							:   List[str]							):
						return self.tokenizer.batch_decode(*UpperCAmelCase_       ,   **UpperCAmelCase_							)
	def      A_				(			self							:   Tuple       ,   *UpperCAmelCase_							:   int       ,   **UpperCAmelCase_							:   List[str]							):
						return self.tokenizer.decode(*UpperCAmelCase_       ,   **UpperCAmelCase_							)





	@contextmanager
	def      A_				(			self							:   str							):
						warnings.warn(
						    '`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your '
						    'labels by using the argument `text` of the regular `__call__` method (either in the same call as '
						    'your audio inputs, or in a separate call.'							)
						SCREAMING_SNAKE_CASE__													= True
						SCREAMING_SNAKE_CASE__													= self.tokenizer
						yield
						SCREAMING_SNAKE_CASE__													= self.feature_extractor
						SCREAMING_SNAKE_CASE__													= False





