


'''simple docstring'''
__snake_case							      =     [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)]


def 			a      (			__a   )  ->	int:



					'''simple docstring'''






					UpperCamelCase__   :List[str]												= 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
__snake_case							      =     [None] * 10000000
__snake_case							      =     True
__snake_case							      =     False


def 			a      (			__a   )  ->	bool:



					'''simple docstring'''






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

					UpperCamelCase__   :Dict												= chain(next_number(__a   )   )
					UpperCamelCase__   :int												= number_chain

					while number < 10000000:
										UpperCamelCase__   :Optional[int]												= number_chain
										number *= 10

					return number_chain


def 			a      (			__a = 10000000   )  ->	int:



					'''simple docstring'''






					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() = }""")


class  A						:







    """simple docstring"""





    def __init__(      self :       Any,lowercase_ :       Tuple,lowercase_ :       Any,lowercase_ :       List[str]		)->    List[Any]:





        '''simple docstring'''







        A__          =   name
        A__          =   value
        A__          =   weight


    def __repr__(      self :       int		)->    Tuple:





        '''simple docstring'''







        return F'{self.__class__.__name__}({self.name}, {self.value}, {self.weight})'


    def 						snake_case__     (      self :       Any		)->    str:





        '''simple docstring'''







        return self.value


    def 						snake_case__     (      self :       Any		)->    Tuple:





        '''simple docstring'''







        return self.name


    def 						snake_case__     (      self :       Any		)->    Dict:





        '''simple docstring'''







        return self.weight


    def 						snake_case__     (      self :       Union[str, Any]		)->    Optional[Any]:





        '''simple docstring'''







        return self.value / self.weight




def 						_snake_case(    SCREAMING_SNAKE_CASE__			:	Optional[Any]    ,			SCREAMING_SNAKE_CASE__			:	List[str]    ,			SCREAMING_SNAKE_CASE__			:	List[Any]      )							->      List[Any]:





    '''simple docstring'''






    A__          =   []
    for i in range(len(SCREAMING_SNAKE_CASE__      )      ):
        menu.append(Things(name[i]    ,			value[i]    ,			weight[i]      )      )
    return menu
def 						_snake_case(    SCREAMING_SNAKE_CASE__			:	Dict    ,			SCREAMING_SNAKE_CASE__			:	List[str]    ,			SCREAMING_SNAKE_CASE__			:	int      )							->      Any:





    '''simple docstring'''






    A__          =   sorted(SCREAMING_SNAKE_CASE__    ,			key=SCREAMING_SNAKE_CASE__    ,			reverse=SCREAMING_SNAKE_CASE__      )
    A__          =   []
    A__      ,						A__          =   0.0, 0.0
    for i in range(len(SCREAMING_SNAKE_CASE__      )      ):
        if (total_cost + items_copy[i].get_weight()) <= max_cost:
            result.append(items_copy[i]      )
            total_cost += items_copy[i].get_weight()
            total_value += items_copy[i].get_value()
    return (result, total_value)
def 						_snake_case(    )							->      Any:





    '''simple docstring'''








if __name__ == "__main__":
     import doctest

     doctest.testmod()

