


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






def 							__lowercase       (			__lowerCAmelCase							:    Optional[int] ,   __lowerCAmelCase							:    Dict ,   __lowerCAmelCase							:    Optional[int] ,   __lowerCAmelCase							:    List[Any]       ):
							a__					=					sum(a_i[j] for j in range(__lowerCAmelCase ,   len(__lowerCAmelCase       )       )       )
							a__					=					sum(a_i[j] * base[j] for j in range(min(len(__lowerCAmelCase       ) ,   __lowerCAmelCase       )       )       )

							a__				, a__					=					0, 0
							a__					=					n - i

							a__					=					memo.get(__lowerCAmelCase       )

							if sub_memo is not None:
														a__					=					sub_memo.get(__lowerCAmelCase       )

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

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

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

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

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

							a__					=					sub_memo[c]

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

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






def 							__lowercase       (			__lowerCAmelCase							:    Dict ,   __lowerCAmelCase							:    Optional[Any] ,   __lowerCAmelCase							:    Dict ,   __lowerCAmelCase							:    Any       ):
							if i >= n:
														return 0, i
							if k > len(__lowerCAmelCase       ):
														a_i.extend([0 for _ in range(k - len(__lowerCAmelCase       )       )]       )

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

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

																					ds_c += a_i[j]

														if addend > 0:
																					break

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






def 							__lowercase       (			__lowerCAmelCase							:    List[str] ,   __lowerCAmelCase							:    str ,   __lowerCAmelCase							:    str       ):
							for j in range(__lowerCAmelCase ,   len(__lowerCAmelCase       )       ):
														a__					=					digits[j] + addend
														if s >= 1_0:
																					a__				, a__					=					divmod(__lowerCAmelCase ,   1_0       )
																					a__					=					addend // 1_0 + quotient
														else:
																					a__					=					s
																					a__					=					addend // 1_0

														if addend == 0:
																					break

							while addend > 0:
														a__				, a__					=					divmod(__lowerCAmelCase ,   1_0       )
														digits.append(__lowerCAmelCase       )






def 							__lowercase       (			__lowerCAmelCase							:    int = 1_0**1_5       ):
							a__					=					[1]
							a__					=					1
							a__					=					0
							while True:
														a__				, a__					=					next_term(__lowerCAmelCase ,   2_0 ,   i + dn ,   __lowerCAmelCase       )
														dn += terms_jumped
														if dn == n - i:
																					break

							a__					=					0
							for j in range(len(__lowerCAmelCase       )       ):
														a_n += digits[j] * 1_0**j
							return a_n


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








from math import ceil, sqrt






def 							__lowercase       (			__lowerCAmelCase							:    int = 1_0_0_0_0_0_0       ):
							a__					=					0

							for outer_width in range(3 ,   (limit // 4) + 2       ):
														if outer_width**2 > limit:
																					a__					=					max(ceil(sqrt(outer_width**2 - limit       )       ) ,   1       )
														else:
																					a__					=					1
														if (outer_width - hole_width_lower_bound) % 2:
																					hole_width_lower_bound += 1

														answer += (outer_width - hole_width_lower_bound - 2) // 2 + 1

							return answer


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




