



"""simple docstring"""





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




def 	UpperCAmelCase     (		A	:						int     ,				A	:						Tuple     ,				A	:						List[str]     ,				A	:						Tuple       ):

		'''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 	UpperCAmelCase     (		A	:						Optional[int]     ,				A	:						Any     ,				A	:						Tuple     ,				A	:						Optional[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 	UpperCAmelCase     (		A	:						Tuple     ,				A	:						Dict     ,				A	:						List[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 	UpperCAmelCase     (		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() = }''')







"""simple docstring"""





from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowercase  							=					logging.get_logger(__name__)

lowercase  							=					{
    '''microsoft/swin-tiny-patch4-window7-224''': (
        '''https://huggingface.co/microsoft/swin-tiny-patch4-window7-224/resolve/main/config.json'''
    ),
    # See all Swin models at https://huggingface.co/models?filter=swin
}




class 			lowercase__			(      A,					A    ):
							'''simple docstring'''







							_UpperCAmelCase      				=					'''swin'''

							_UpperCAmelCase      				=					{
							    '''num_attention_heads''': '''num_heads''',
							    '''num_hidden_layers''': '''num_layers''',
							}






							def __init__(  self	,       snake_case=224	,       snake_case=4	,       snake_case=3	,       snake_case=96	,       snake_case=[2, 2, 6, 2]	,       snake_case=[3, 6, 12, 24]	,       snake_case=7	,       snake_case=4.0	,       snake_case=True	,       snake_case=0.0	,       snake_case=0.0	,       snake_case=0.1	,       snake_case="gelu"	,       snake_case=False	,       snake_case=0.02	,       snake_case=1E-5	,       snake_case=32	,       snake_case=None	,       snake_case=None	,       **snake_case	,       )			->							List[Any]:
									super().__init__(**snake_case						)

									_UpperCAmelCase							 =		image_size
									_UpperCAmelCase							 =		patch_size
									_UpperCAmelCase							 =		num_channels
									_UpperCAmelCase							 =		embed_dim
									_UpperCAmelCase							 =		depths
									_UpperCAmelCase							 =		len(snake_case						)
									_UpperCAmelCase							 =		num_heads
									_UpperCAmelCase							 =		window_size
									_UpperCAmelCase							 =		mlp_ratio
									_UpperCAmelCase							 =		qkv_bias
									_UpperCAmelCase							 =		hidden_dropout_prob
									_UpperCAmelCase							 =		attention_probs_dropout_prob
									_UpperCAmelCase							 =		drop_path_rate
									_UpperCAmelCase							 =		hidden_act
									_UpperCAmelCase							 =		use_absolute_embeddings
									_UpperCAmelCase							 =		layer_norm_eps
									_UpperCAmelCase							 =		initializer_range
									_UpperCAmelCase							 =		encoder_stride
									# we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
									# this indicates the channel dimension after the last stage of the model
									_UpperCAmelCase							 =		int(embed_dim * 2 ** (len(snake_case						) - 1)						)
									_UpperCAmelCase							 =		['stem'] + [f'stage{idx}' for idx in range(1	,       len(snake_case						) + 1						)]
									_UpperCAmelCase ,					_UpperCAmelCase							 =		get_aligned_output_features_output_indices(
									    out_features=snake_case	,       out_indices=snake_case	,       stage_names=self.stage_names						)







class 			lowercase__			(      A    ):
							'''simple docstring'''







							_UpperCAmelCase      				=					version.parse('''1.11'''    )






							@property
							def        lowerCamelCase_   (  self						)			->							Mapping[str, Mapping[int, str]]:
									return OrderedDict(
									    [
									        ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
									    ]						)






							@property
							def        lowerCamelCase_   (  self						)			->							float:
									return 1E-4


