




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







def 		_A(       UpperCamelCase__							:			int				,       UpperCamelCase__							:			List[str]				,       UpperCamelCase__							:			List[Any]				,       UpperCamelCase__							:			Union[str, Any]				)    -> Optional[Any]:
							'''simple docstring'''


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

							__lowercase     ,     __lowercase      =    0, 0
							__lowercase      =    n - i

							__lowercase      =    memo.get(UpperCamelCase__				)

							if sub_memo is not None:
														__lowercase      =    sub_memo.get(UpperCamelCase__				)

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

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

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

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

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

							__lowercase      =    sub_memo[c]

							# keep jumps sorted by # of terms skipped
							__lowercase      =    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 		_A(       UpperCamelCase__							:			int				,       UpperCamelCase__							:			Union[str, Any]				,       UpperCamelCase__							:			List[Any]				,       UpperCamelCase__							:			Dict				)    -> List[str]:
							'''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)
							__lowercase      =    i
							__lowercase     ,     __lowercase     ,     __lowercase      =    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
														__lowercase      =    ds_c + ds_b
														diff += addend
														__lowercase      =    0
														for j in range(UpperCamelCase__				):
																					__lowercase      =    a_i[j] + addend
																					__lowercase     ,     __lowercase      =    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 		_A(       UpperCamelCase__							:			Tuple				,       UpperCamelCase__							:			Tuple				,       UpperCamelCase__							:			int				)    -> Any:
							'''simple docstring'''


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

														if addend == 0:
																					break

							while addend > 0:
														__lowercase     ,     __lowercase      =    divmod(UpperCamelCase__				,       10				)
														digits.append(UpperCamelCase__				)







def 		_A(       UpperCamelCase__							:			int = 10**15				)    -> int:
							'''simple docstring'''


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

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


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












import argparse


UpperCAmelCase__				     = "docs/source/_static/js/custom.js"







def 		_A(       UpperCamelCase__							:			Optional[int]				)    -> Optional[int]:
							'''simple docstring'''


							with open(UpperCamelCase__				,       encoding='''utf-8'''				,       newline='''\n'''				) as f:
														__lowercase      =    f.readlines()
							__lowercase      =    0

							# First let's put the right version
							while not lines[index].startswith('''const stableVersion ='''				):
														index += 1
							__lowercase      =    F'const stableVersion = "v{version}"\n'

							# Then update the dictionary
							while not lines[index].startswith('''const versionMapping = {'''				):
														index += 1

							# We go until the end
							while not lines[index].startswith('''}'''				):
														index += 1
							# We add the new version at the end
							lines[index - 1] += F'    "v{version}": "v{version}",\n'

							with open(UpperCamelCase__				,       '''w'''				,       encoding='''utf-8'''				,       newline='''\n'''				) as f:
														f.writelines(UpperCamelCase__				)


if __name__ == "__main__":
			UpperCAmelCase__				     = argparse.ArgumentParser()
			parser.add_argument("--version", help="Release version.")
			UpperCAmelCase__				     = parser.parse_args()
			update_custom_js(args.version)






