





lowerCAmelCase_   :   Dict       =					[sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)]







def    _lowerCamelCase  (__lowerCamelCase  :     int     )   ->    Optional[Any]:
			a__     = 0
			while number:
						# Increased Speed Slightly by checking every 5 digits together.
						sum_of_digits_squared += DIGITS_SQUARED[number % 10_0000]
						number //= 10_0000

			return sum_of_digits_squared


# There are 2 Chains made,
# One ends with 89 with the chain member 58 being the one which when declared first,
# there will be the least number of iterations for all the members to be checked.

# The other one ends with 1 and has only one element 1.

# So 58 and 1 are chosen to be declared at the starting.

# Changed dictionary to an array to quicken the solution
lowerCAmelCase_   :   str       =					[None] * 10000000
lowerCAmelCase_   :   List[str]       =					True
lowerCAmelCase_   :   str       =					False







def    _lowerCamelCase  (__lowerCamelCase  :     int     )   ->    Optional[Any]:




			if CHAINS[number - 1] is not None:
						return CHAINS[number - 1]  # type: ignore

			a__     = chain(next_number(__a     )     )
			a__     = number_chain

			while number < 1000_0000:
						a__     = number_chain
						number *= 10

			return number_chain







def    _lowerCamelCase  (__lowerCamelCase  :     int = 1000_0000     )   ->    int:




			for i in range(1					,  __a     ):
						if CHAINS[i] is None:
									chain(i + 1     )

			return CHAINS[:number].count(__a     )


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		print(f"""{solution() = }""")










'''simple docstring'''


def    _lowerCamelCase  (__lowerCamelCase  :     int = 400_0000     )   ->    int:
			a__     = [0, 1]
			a__     = 0
			while fib[i] <= n:
						fib.append(fib[i] + fib[i + 1]     )
						if fib[i + 2] > n:
									break
						i += 1
			a__     = 0
			for j in range(len(__lowerCamelCase     ) - 1     ):
						if fib[j] % 2 == 0:
									total += fib[j]

			return total


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



