"""simple docstring"""


from __future__ import annotations

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

a							=TypeVar('T')
a							=TypeVar('U')






class    __UpperCAmelCase						(	Generic[T, U]	):

				def __init__(      self	, _lowerCamelCase	, _lowerCamelCase      ):
										lowerCamelCase__					=key
										lowerCamelCase__					=val
										lowerCamelCase__					=0
										lowerCamelCase__					=None
										lowerCamelCase__					=None






				def __repr__(      self      ):
										return "Node: key: {}, val: {}, freq: {}, has next: {}, has prev: {}".format(
										    self.key	, self.val	, self.freq	, self.next is not None	, self.prev is not None      )






class    __UpperCAmelCase						(	Generic[T, U]	):

				def __init__(      self      ):
										lowerCamelCase__					=DoubleLinkedListNode(_lowerCamelCase	, _lowerCamelCase      )
										lowerCamelCase__					=DoubleLinkedListNode(_lowerCamelCase	, _lowerCamelCase      )
										lowerCamelCase__					,      lowerCamelCase__					=self.rear, self.head

				def __repr__(      self      ):
										lowerCamelCase__					=["DoubleLinkedList"]
										lowerCamelCase__					=self.head
										while node.next is not None:
																rep.append(str(_lowerCamelCase      )      )
																lowerCamelCase__					=node.next
										rep.append(str(self.rear      )      )
										return ",\n    ".join(_lowerCamelCase      )

				def 		_a	(      self	, _lowerCamelCase      ):
										lowerCamelCase__					=self.rear.prev

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

										lowerCamelCase__					=node
										lowerCamelCase__					=previous
										lowerCamelCase__					=node
										lowerCamelCase__					=self.rear
										node.freq += 1
										self._position_node(_lowerCamelCase      )

				def 		_a	(      self	, _lowerCamelCase      ):

										while node.prev is not None and node.prev.freq > node.freq:
																# swap node with previous node
																lowerCamelCase__					=node.prev

																lowerCamelCase__					=previous_node.prev
																lowerCamelCase__					=node.prev
																lowerCamelCase__					=previous_node
																lowerCamelCase__					=node






				def 		_a	(      self	, _lowerCamelCase      ):

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

										lowerCamelCase__					=node.next
										lowerCamelCase__					=node.prev
										lowerCamelCase__					=None
										lowerCamelCase__					=None
										return node






class    __UpperCAmelCase						(	Generic[T, U]	):
				A__      :   dict[Callable[[T], U], LFUCache[T, U]]  							=       {}

				def __init__(      self	, _lowerCamelCase      ):
										lowerCamelCase__					=DoubleLinkedList()
										lowerCamelCase__					=capacity
										lowerCamelCase__					=0
										lowerCamelCase__					=0
										lowerCamelCase__					=0
										lowerCamelCase__					={}

				def __repr__(      self      ):
										return (
										    F'''CacheInfo(hits={self.hits}, misses={self.miss}, '''
										    F'''capacity={self.capacity}, current_size={self.num_keys})'''
										)

				def __contains__(      self	, _lowerCamelCase      ):
										return key in self.cache

				def 		_a	(      self	, _lowerCamelCase      ):

										if key in self.cache:
																self.hits += 1
																lowerCamelCase__					=self.cache[key]
																lowerCamelCase__					=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(_lowerCamelCase      )
																return node.val
										self.miss += 1
										return None

				def 		_a	(      self	, _lowerCamelCase	, _lowerCamelCase      ):

										if key not in self.cache:
																if self.num_keys >= self.capacity:
																						# delete first node when over capacity
																						lowerCamelCase__					=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(_lowerCamelCase      ) is not None
																						# first_node guaranteed to be in list

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

										else:
																lowerCamelCase__					=self.list.remove(self.cache[key]      )
																assert node is not None  # node guaranteed to be in list
																lowerCamelCase__					=value
																self.list.add(_lowerCamelCase      )






				@classmethod
				def 		_a	(      cls	, _lowerCamelCase = 128      ):

										def cache_decorator_inner(_lowerCamelCase      ) -> Callable[..., U]:
																def cache_decorator_wrapper(*_lowerCamelCase      ) -> U:
																						if func not in cls.decorator_function_to_instance_map:
																												lowerCamelCase__					=LFUCache(_lowerCamelCase      )

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

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

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

																return cache_decorator_wrapper

										return cache_decorator_inner


if __name__ == "__main__":
	import doctest

	doctest.testmod()






def 		a__       (							A__ = 2_0							):

			try:
						SCREAMING_SNAKE_CASE_						:			Optional[Any]       						= int(A__							)
			except (TypeError, ValueError):
						raise TypeError('Parameter n must be int or castable to int.'							)
			if n <= 0:
						raise ValueError('Parameter n must be greater than or equal to one.'							)
			SCREAMING_SNAKE_CASE_						:			int       						= 0
			while 1:
						i += n * (n - 1)
						SCREAMING_SNAKE_CASE_						:			List[str]       						= 0
						for j in range(2,	A__							):
									if i % j != 0:
												SCREAMING_SNAKE_CASE_						:			str       						= 1
												break
						if nfound == 0:
									if i == 0:
												SCREAMING_SNAKE_CASE_						:			Tuple       						= 1
									return i
			return None


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





