



"""simple docstring"""







class  UpperCamelCase__  :




      """simple docstring"""




      class  UpperCamelCase__  :




            """simple docstring"""




            _SCREAMING_SNAKE_CASE    							=	"""_prev""", """_data""", """_next"""



            def __init__( self							: Union[str, Any]       ,     SCREAMING_SNAKE_CASE_							: Any       ,     SCREAMING_SNAKE_CASE_							: List[Any]       ,     SCREAMING_SNAKE_CASE_							: Any			):
              lowerCAmelCase_  :							int								=					link_p
              lowerCAmelCase_  :							Any								=					element
              lowerCAmelCase_  :							str								=					link_n





            def 	SCREAMING_SNAKE_CASE__					( self							: Optional[int]			):
              return (
                  F" Prev -> {self._prev is not None}, Next -> {self._next is not None}"
              )




      def __init__( self							: int			):
        lowerCAmelCase_  :							List[Any]								=					self._Node(SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_			)
        lowerCAmelCase_  :							Any								=					self._Node(SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_			)
        lowerCAmelCase_  :							List[Any]								=					self._trailer
        lowerCAmelCase_  :							Optional[int]								=					self._header
        lowerCAmelCase_  :							str								=					0



      def __len__( self							: Union[str, Any]			):
        return self._size



      def 	SCREAMING_SNAKE_CASE__					( self							: Optional[int]			):
        return self.__len__() == 0



      def 	SCREAMING_SNAKE_CASE__					( self							: int       ,     SCREAMING_SNAKE_CASE_							: int       ,     SCREAMING_SNAKE_CASE_							: List[Any]       ,     SCREAMING_SNAKE_CASE_							: Optional[Any]			):
        # Create new_node by setting it's prev.link -> header
        # setting it's next.link -> trailer
        lowerCAmelCase_  :							List[str]								=					self._Node(SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_			)
        lowerCAmelCase_  :							Any								=					new_node
        lowerCAmelCase_  :							str								=					new_node
        self._size += 1
        return self





      def 	SCREAMING_SNAKE_CASE__					( self							: str       ,     SCREAMING_SNAKE_CASE_							: Optional[Any]			):
        lowerCAmelCase_  :							Tuple								=					node._prev
        lowerCAmelCase_  :							Any								=					node._next

        lowerCAmelCase_  :							Union[str, Any]								=					successor
        lowerCAmelCase_  :							str								=					predecessor
        self._size -= 1
        lowerCAmelCase_  :							Tuple								=					node._data
        lowerCAmelCase_  :							int								=					None
        del node
        return temp







class  UpperCamelCase__  (      _DoublyLinkedBase    ):




      """simple docstring"""




      def 	SCREAMING_SNAKE_CASE__					( self							: str			):
        if self.is_empty():
          raise Exception('List is empty'			)
        return self._header._next._data



      def 	SCREAMING_SNAKE_CASE__					( self							: Any			):
        if self.is_empty():
          raise Exception('List is empty'			)
        return self._trailer._prev._data



      def 	SCREAMING_SNAKE_CASE__					( self							: Union[str, Any]       ,     SCREAMING_SNAKE_CASE_							: Union[str, Any]			):
        return self._insert(self._header       ,     SCREAMING_SNAKE_CASE_       ,     self._header._next			)



      def 	SCREAMING_SNAKE_CASE__					( self							: Optional[Any]       ,     SCREAMING_SNAKE_CASE_							: Any			):
        return self._insert(self._trailer._prev       ,     SCREAMING_SNAKE_CASE_       ,     self._trailer			)



      def 	SCREAMING_SNAKE_CASE__					( self							: Union[str, Any]			):
        if self.is_empty():
          raise IndexError('remove_first from empty list'			)
        return self._delete(self._header._next			)





      def 	SCREAMING_SNAKE_CASE__					( self							: Tuple			):
        if self.is_empty():
          raise IndexError('remove_first from empty list'			)
        return self._delete(self._trailer._prev			)










"""simple docstring"""







def 							UpperCamelCase_       (       lowerCAmelCase__ :							int = 400_0000		)		->  int:

  """simple docstring"""




  if n <= 1:
    return 0
  lowerCAmelCase_  :							Union[str, Any]								=					0
  lowerCAmelCase_  :							Tuple								=					2
  lowerCAmelCase_  :							List[Any]								=					0
  while 4 * b + a <= n:
    lowerCAmelCase_		,lowerCAmelCase_  :							str								=					b, 4 * b + a
    count += a
  return count + b


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





