





'''simple docstring'''

lowercase__						:      int	=    [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_00_00)]







def  a__    (    lowercase :					int				)		->		int:





     """simple docstring"""

     _UpperCamelCase       =	0
     while number:
          # Increased Speed Slightly by checking every 5 digits together.
          sum_of_digits_squared += DIGITS_SQUARED[number % 100000]
          number //= 100000

     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
lowercase__						:      list[bool | None]	=    [None] * 10_00_00_00
lowercase__						:      Dict	=    True
lowercase__						:      Any	=    False







def  a__    (    lowercase :					int				)		->		bool:





     """simple docstring"""

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

     _UpperCamelCase       =	chain(next_number(lowercase				)				)
     _UpperCamelCase       =	number_chain

     while number < 10000000:
          _UpperCamelCase       =	number_chain
          number *= 10

     return number_chain







def  a__    (    lowercase :					int = 10000000				)		->		int:





     """simple docstring"""

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

     return CHAINS[:number].count(lowercase				)


if __name__ == "__main__":
   import doctest

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










'''simple docstring'''

from math import isclose, sqrt







def  a__    (    lowercase :					float, lowercase :					float, lowercase :					float				)		->		tuple[float, float, float]:





     """simple docstring"""

     _UpperCamelCase       =	point_y / 4 / point_x
     _UpperCamelCase       =	2 * normal_gradient / (1 + normal_gradient * normal_gradient)
     _UpperCamelCase       =	(1 - normal_gradient * normal_gradient) / (
         1 + normal_gradient * normal_gradient
     )
     _UpperCamelCase       =	(sa - ca * incoming_gradient) / (ca + sa * incoming_gradient)

     # to find the next point, solve the simultaeneous equations:
     # y^2 + 4x^2 = 100
     # y - b = m * (x - a)
     # ==> A x^2 + B x + C = 0
     _UpperCamelCase       =	outgoing_gradient**2 + 4
     _UpperCamelCase       =	2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
     _UpperCamelCase       =	(point_y - outgoing_gradient * point_x) ** 2 - 100

     _UpperCamelCase       =	(
         -linear_term - sqrt(linear_term**2 - 4 * quadratic_term * constant_term				)
     ) / (2 * quadratic_term)
     _UpperCamelCase       =	(
         -linear_term + sqrt(linear_term**2 - 4 * quadratic_term * constant_term				)
     ) / (2 * quadratic_term)

     # two solutions, one of which is our input point
     _UpperCamelCase       =	x_minus if isclose(lowercase, lowercase				) else x_plus
     _UpperCamelCase       =	point_y + outgoing_gradient * (next_x - point_x)

     return next_x, next_y, outgoing_gradient







def  a__    (    lowercase :					float = 1.4, lowercase :					float = -9.6				)		->		int:





     """simple docstring"""

     _UpperCamelCase       =	0
     _UpperCamelCase       =	first_x_coord
     _UpperCamelCase       =	first_y_coord
     _UpperCamelCase       =	(1_0.1 - point_y) / (0.0 - point_x)

     while not (-0.0_1 <= point_x <= 0.0_1 and point_y > 0):
          _UpperCamelCase   ,    _UpperCamelCase   ,    _UpperCamelCase       =	next_point(lowercase, lowercase, lowercase				)
          num_reflections += 1

     return num_reflections


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



