



def 					__lowerCamelCase					(   lowerCamelCase__     , lowerCamelCase__ = 0						):

				"""simple docstring"""


				lowercase__     :    Any													=     length or len(lowerCamelCase__						)
				lowercase__     :    Optional[int]													=     False
				for i in range(length - 1						):
								if list_data[i] > list_data[i + 1]:
												lowercase__     :    Dict													=     list_data[i + 1], list_data[i]
												lowercase__     :    Optional[Any]													=     True

				return list_data if not swapped else bubble_sort(lowerCamelCase__     , length - 1						)


if __name__ == "__main__":
				import doctest

				doctest.testmod()












'''simple docstring'''







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





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase      )      ->       List[Any]:
							lowerCamelCase__					:	List[str]         =       sum(a_i[j] for j in range(UpperCamelCase				,			len(UpperCamelCase      )      )      )
							lowerCamelCase__					:	int         =       sum(a_i[j] * base[j] for j in range(min(len(UpperCamelCase      )				,			UpperCamelCase      )      )      )

							lowerCamelCase__  ,		lowerCamelCase__					:	Dict         =       0, 0
							lowerCamelCase__					:	List[str]         =       n - i

							lowerCamelCase__					:	Optional[Any]         =       memo.get(UpperCamelCase      )

							if sub_memo is not None:
														lowerCamelCase__					:	str         =       sub_memo.get(UpperCamelCase      )

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

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

														else:
																					lowerCamelCase__					:	Any         =       []
							else:
														lowerCamelCase__					:	str         =       {c: []}
														lowerCamelCase__					:	Tuple         =       sub_memo

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

							if k > ks[0]:
														while True:
																					# keep doing smaller jumps
																					lowerCamelCase__  ,		lowerCamelCase__					:	Dict         =       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
														lowerCamelCase__  ,		lowerCamelCase__					:	Optional[int]         =       compute(UpperCamelCase				,			UpperCamelCase				,			i + dn				,			UpperCamelCase      )
														diff += _diff
														dn += terms_jumped

							lowerCamelCase__					:	str         =       sub_memo[c]

							# keep jumps sorted by # of terms skipped
							lowerCamelCase__					:	List[Any]         =       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  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase      )      ->       List[Any]:
							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)
							lowerCamelCase__					:	Optional[Any]         =       i
							lowerCamelCase__  ,		lowerCamelCase__  ,		lowerCamelCase__					:	Optional[int]         =       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
														lowerCamelCase__					:	Optional[int]         =       ds_c + ds_b
														diff += addend
														lowerCamelCase__					:	int         =       0
														for j in range(UpperCamelCase      ):
																					lowerCamelCase__					:	str         =       a_i[j] + addend
																					lowerCamelCase__  ,		lowerCamelCase__					:	int         =       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  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase      )      ->       str:
							for j in range(UpperCamelCase				,			len(UpperCamelCase      )      ):
														lowerCamelCase__					:	List[Any]         =       digits[j] + addend
														if s >= 10:
																					lowerCamelCase__  ,		lowerCamelCase__					:	Union[str, Any]         =       divmod(UpperCamelCase				,			10      )
																					lowerCamelCase__					:	Any         =       addend // 10 + quotient
														else:
																					lowerCamelCase__					:	Any         =       s
																					lowerCamelCase__					:	Optional[Any]         =       addend // 10

														if addend == 0:
																					break

							while addend > 0:
														lowerCamelCase__  ,		lowerCamelCase__					:	Any         =       divmod(UpperCamelCase				,			10      )
														digits.append(UpperCamelCase      )





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase = 10**15      )      ->       int:
							lowerCamelCase__					:	Any         =       [1]
							lowerCamelCase__					:	List[str]         =       1
							lowerCamelCase__					:	Tuple         =       0
							while True:
														lowerCamelCase__  ,		lowerCamelCase__					:	Any         =       next_term(UpperCamelCase				,			20				,			i + dn				,			UpperCamelCase      )
														dn += terms_jumped
														if dn == n - i:
																					break

							lowerCamelCase__					:	Union[str, Any]         =       0
							for j in range(len(UpperCamelCase      )      ):
														a_n += digits[j] * 10**j
							return a_n


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

