


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







def 						_a				(      _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)    ->				List[Any]:
							snake_case_           =		sum(a_i[j] for j in range(_SCREAMING_SNAKE_CASE				, len(_SCREAMING_SNAKE_CASE				)				)				)
							snake_case_           =		sum(a_i[j] * base[j] for j in range(min(len(_SCREAMING_SNAKE_CASE				)				, _SCREAMING_SNAKE_CASE				)				)				)

							snake_case_       ,						snake_case_           =		0, 0
							snake_case_           =		n - i

							snake_case_           =		memo.get(_SCREAMING_SNAKE_CASE				)

							if sub_memo is not None:
														snake_case_           =		sub_memo.get(_SCREAMING_SNAKE_CASE				)

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

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

														else:
																					snake_case_           =		[]
							else:
														snake_case_           =		{c: []}
														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
																					snake_case_       ,						snake_case_           =		next_term(_SCREAMING_SNAKE_CASE				, k - 1				, i + dn				, _SCREAMING_SNAKE_CASE				)
																					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
														snake_case_       ,						snake_case_           =		compute(_SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, i + dn				, _SCREAMING_SNAKE_CASE				)
														diff += _diff
														dn += terms_jumped

							snake_case_           =		sub_memo[c]

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

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







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

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

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

																					ds_c += a_i[j]

														if addend > 0:
																					break

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







def 						_a				(      _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)    ->				Any:
							for j in range(_SCREAMING_SNAKE_CASE				, len(_SCREAMING_SNAKE_CASE				)				):
														snake_case_           =		digits[j] + addend
														if s >= 10:
																					snake_case_       ,						snake_case_           =		divmod(_SCREAMING_SNAKE_CASE				, 10				)
																					snake_case_           =		addend // 10 + quotient
														else:
																					snake_case_           =		s
																					snake_case_           =		addend // 10

														if addend == 0:
																					break

							while addend > 0:
														snake_case_       ,						snake_case_           =		divmod(_SCREAMING_SNAKE_CASE				, 10				)
														digits.append(_SCREAMING_SNAKE_CASE				)







def 						_a				(      _SCREAMING_SNAKE_CASE = 10**15				)    ->				int:
							snake_case_           =		[1]
							snake_case_           =		1
							snake_case_           =		0
							while True:
														snake_case_       ,						snake_case_           =		next_term(_SCREAMING_SNAKE_CASE				, 20				, i + dn				, _SCREAMING_SNAKE_CASE				)
														dn += terms_jumped
														if dn == n - i:
																					break

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


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







"""simple docstring"""
import secrets
from random import shuffle
from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation







def 						_a				(      _SCREAMING_SNAKE_CASE = 8				)    ->				str:
							snake_case_           =		ascii_letters + digits + punctuation
							return "".join(secrets.choice(_SCREAMING_SNAKE_CASE				) for _ in range(_SCREAMING_SNAKE_CASE				)				)







def 						_a				(      _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)    ->				str:
							# Password Generator = full boot with random_number, random_letters, and
							# random_character FUNCTIONS
							# Put your code here...
							i -= len(_SCREAMING_SNAKE_CASE				)
							snake_case_           =		i // 3
							snake_case_           =		i % 3
							# chars = chars_incl + random_letters(ascii_letters, i / 3 + remainder) +
							#     random_number(digits, i / 3) + random_characters(punctuation, i / 3)
							snake_case_           =		(
							    chars_incl
							    + random(_SCREAMING_SNAKE_CASE				, quotient + remainder				)
							    + random(_SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)
							    + random(_SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)
							)
							snake_case_           =		list(_SCREAMING_SNAKE_CASE				)
							shuffle(_SCREAMING_SNAKE_CASE				)
							return "".join(_SCREAMING_SNAKE_CASE				)

							# random is a generalised function for letters, characters and numbers







def 						_a				(      _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)    ->				str:
							return "".join(secrets.choice(_SCREAMING_SNAKE_CASE				) for _ in range(_SCREAMING_SNAKE_CASE				)				)







def 						_a				(      _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)    ->				Any:
							pass  # Put your code here...







def 						_a				(      _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)    ->				List[str]:
							pass  # Put your code here...







def 						_a				(      _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)    ->				Optional[int]:
							pass  # Put your code here...







def 						_a				(      _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE = 8				)    ->				bool:

							if len(_SCREAMING_SNAKE_CASE				) < min_length:
														# Your Password must be at least 8 characters long
														return False

							snake_case_           =		any(char in ascii_uppercase for char in password				)
							snake_case_           =		any(char in ascii_lowercase for char in password				)
							snake_case_           =		any(char in digits for char in password				)
							snake_case_           =		any(char in punctuation for char in password				)

							return upper and lower and num and spec_char
							# Passwords should contain UPPERCASE, lowerase
							# numbers, and special characters







def 						_a				(      )    ->				str:
							snake_case_           =		int(input("""Please indicate the max length of your password: """				).strip()				)
							snake_case_           =		input(
							    """Please indicate the characters that must be in your password: """				).strip()
							print("""Password generated:"""				, password_generator(_SCREAMING_SNAKE_CASE				)				)
							print(
							    """Alternative Password generated:"""				, alternative_password_generator(_SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)				, )
							print("""[If you are thinking of using this passsword, You better save it.]"""				)


if __name__ == "__main__":
				main()



