




from __future__ import annotations

from collections.abc import Callable
from typing import Generic, TypeVar

__magic_name__	:       Any     =	TypeVar('T')
__magic_name__	:       str     =	TypeVar('U')




class 					snake_case__							(Generic[T, U]     ):
				"""simple docstring"""



				def __init__(   self       :  Optional[Any]      ,   __lowerCamelCase       :  Any      ,   __lowerCamelCase       :  Dict							)      ->  List[Any]:
							a					=    key
							a					=    val
							a					=    None
							a					=    None





				def __repr__(   self       :  Tuple							)      ->  str:
							return (
							    f"""Node: key: {self.key}, val: {self.val}, """
							    f"""has next: {bool(self.next							)}, has prev: {bool(self.prev							)}"""
							)




class 					snake_case__							(Generic[T, U]     ):
				"""simple docstring"""



				def __init__(   self       :  Any							)      ->  None:
							a					=    DoubleLinkedListNode(lowercase__      ,   lowercase__							)
							a					=    DoubleLinkedListNode(lowercase__      ,   lowercase__							)
							a					=    self.rear, self.head





				def __repr__(   self       :  Dict							)      ->  str:
							a					=    ['''DoubleLinkedList''']
							a					=    self.head
							while node.next is not None:
										rep.append(str(lowercase__							)							)
										a					=    node.next
							rep.append(str(self.rear							)							)
							return ",\n    ".join(lowercase__							)





				def 							__UpperCAmelCase							(   self       :  Optional[Any]      ,   __lowerCamelCase       :  str							)      ->  None:
							a					=    self.rear.prev

							# All nodes other than self.head are guaranteed to have non-None previous
							assert previous is not None

							a					=    node
							a					=    previous
							a					=    node
							a					=    self.rear





				def 							__UpperCAmelCase							(   self       :  Any      ,   __lowerCamelCase       :  Optional[Any]							)      ->  DoubleLinkedListNode[T, U] | None:





							if node.prev is None or node.next is None:
										return None

							a					=    node.next
							a					=    node.prev
							a					=    None
							a					=    None
							return node




class 					snake_case__							(Generic[T, U]     ):
				"""simple docstring"""



				SCREAMING_SNAKE_CASE_ :							dict[Callable[[T], U], LRUCache[T, U]]											=      {}





				def __init__(   self       :  Union[str, Any]      ,   __lowerCamelCase       :  Dict							)      ->  Union[str, Any]:
							a					=    DoubleLinkedList()
							a					=    capacity
							a					=    0
							a					=    0
							a					=    0
							a					=    {}





				def __repr__(   self       :  str							)      ->  str:
							return (
							    f"""CacheInfo(hits={self.hits}, misses={self.miss}, """
							    f"""capacity={self.capacity}, current size={self.num_keys})"""
							)





				def __contains__(   self       :  List[Any]      ,   __lowerCamelCase       :  str							)      ->  bool:
							return key in self.cache





				def 							__UpperCAmelCase							(   self       :  int      ,   __lowerCamelCase       :  Dict							)      ->  U | None:





							if key in self.cache:
										self.hits += 1
										a					=    self.cache[key]
										a					=    self.list.remove(self.cache[key]							)
										assert node == value_node

										# node is guaranteed not None because it is in self.cache
										assert node is not None
										self.list.add(lowercase__							)
										return node.val
							self.miss += 1
							return None





				def 							__UpperCAmelCase							(   self       :  List[Any]      ,   __lowerCamelCase       :  Any      ,   __lowerCamelCase       :  str							)      ->  None:





							if key not in self.cache:
										if self.num_keys >= self.capacity:
													# delete first node (oldest) when over capacity
													a					=    self.list.head.next

													# guaranteed to have a non-None first node when num_keys > 0
													# explain to type checker via assertions
													assert first_node is not None
													assert first_node.key is not None
													assert (
													    self.list.remove(lowercase__							) is not None
													)  # node guaranteed to be in list assert node.key is not None

													del self.cache[first_node.key]
													self.num_keys -= 1
										a					=    DoubleLinkedListNode(lowercase__      ,   lowercase__							)
										self.list.add(self.cache[key]							)
										self.num_keys += 1

							else:
										# bump node to the end of the list, update value
										a					=    self.list.remove(self.cache[key]							)
										assert node is not None  # node guaranteed to be in list
										a					=    value
										self.list.add(lowercase__							)





				@classmethod
				def 							__UpperCAmelCase							(   cls       :  int      ,   __lowerCamelCase       :  str = 1_28							)      ->  Callable[[Callable[[T], U]], Callable[..., U]]:





							def cache_decorator_inner(__lowerCamelCase       :  int							) -> Callable[..., U]:
										def cache_decorator_wrapper(*__lowerCamelCase       :  List[str]							) -> U:
													if func not in cls.decorator_function_to_instance_map:
																a					=    LRUCache(lowercase__							)

													a					=    cls.decorator_function_to_instance_map[func].get(args[0]							)
													if result is None:
																a					=    func(*lowercase__							)
																cls.decorator_function_to_instance_map[func].put(args[0]      ,   lowercase__							)
													return result

										def cache_info() -> LRUCache[T, U]:
													return cls.decorator_function_to_instance_map[func]

										setattr(lowercase__      ,   "cache_info"      ,   lowercase__							)  # noqa: B010

										return cache_decorator_wrapper

							return cache_decorator_inner


if __name__ == "__main__":
		import doctest

		doctest.testmod()












__lowerCAmelCase	:       List[Any]     =	{str(digit): digit**5 for digit in range(10)}




def     __magic_name__       (				A	:      int     ):






			'''simple docstring'''







			return sum(DIGITS_FIFTH_POWER[digit] for digit in str(A     )     )




def     __magic_name__       (				):






			'''simple docstring'''







			return sum(
			    number
			    for number in range(1000,						1000000     )
			    if number == digits_fifth_powers_sum(A     )     )


if __name__ == "__main__":
		print(solution())






