






"""simple docstring"""





class 		_a       :





   '''simple docstring'''






   class 		_a       :





      '''simple docstring'''






      UpperCamelCase__      					=    '''_prev''', '''_data''', '''_next'''





      def __init__(   self			,				UpperCAmelCase_			,				UpperCAmelCase_			,				UpperCAmelCase_)	-> Optional[Any]:




             '''simple docstring'''




             lowercase__:    Optional[Any]        =      link_p
             lowercase__:    Union[str, Any]        =      element
             lowercase__:    List[str]        =      link_n





      def __lowercase    (   self)	-> List[Any]:




             '''simple docstring'''




             return (
                 F""" Prev -> {self._prev is not None}, Next -> {self._next is not None}"""
             )







   def __init__(   self)	-> Dict:




          '''simple docstring'''




          lowercase__:    List[str]        =      self._Node(lowerCAmelCase__			,				lowerCAmelCase__			,				lowerCAmelCase__)
          lowercase__:    Optional[Any]        =      self._Node(lowerCAmelCase__			,				lowerCAmelCase__			,				lowerCAmelCase__)
          lowercase__:    int        =      self._trailer
          lowercase__:    Any        =      self._header
          lowercase__:    Any        =      0





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




          '''simple docstring'''




          return self._size





   def __lowercase    (   self)	-> Optional[Any]:




          '''simple docstring'''




          return self.__len__() == 0





   def __lowercase    (   self			,				UpperCAmelCase_			,				UpperCAmelCase_			,				UpperCAmelCase_)	-> Union[str, Any]:




          '''simple docstring'''




          lowercase__:    List[str]        =      self._Node(lowerCAmelCase__			,				lowerCAmelCase__			,				lowerCAmelCase__)
          lowercase__:    Optional[int]        =      new_node
          lowercase__:    List[Any]        =      new_node
          self._size += 1
          return self





   def __lowercase    (   self			,				UpperCAmelCase_)	-> Any:




          '''simple docstring'''




          lowercase__:    str        =      node._prev
          lowercase__:    Dict        =      node._next

          lowercase__:    int        =      successor
          lowercase__:    Dict        =      predecessor
          self._size -= 1
          lowercase__:    int        =      node._data
          lowercase__:    int        =      None
          del node
          return temp







class 		_a       (		_DoublyLinkedBase   ):





   '''simple docstring'''






   def __lowercase    (   self)	-> Any:




          '''simple docstring'''




          if self.is_empty():
                 raise Exception("List is empty")
          return self._header._next._data





   def __lowercase    (   self)	-> str:




          '''simple docstring'''




          if self.is_empty():
                 raise Exception("List is empty")
          return self._trailer._prev._data





   def __lowercase    (   self			,				UpperCAmelCase_)	-> List[Any]:




          '''simple docstring'''




          return self._insert(self._header			,				lowerCAmelCase__			,				self._header._next)





   def __lowercase    (   self			,				UpperCAmelCase_)	-> Any:




          '''simple docstring'''




          return self._insert(self._trailer._prev			,				lowerCAmelCase__			,				self._trailer)





   def __lowercase    (   self)	-> Tuple:




          '''simple docstring'''




          if self.is_empty():
                 raise IndexError("remove_first from empty list")
          return self._delete(self._header._next)





   def __lowercase    (   self)	-> List[Any]:




          '''simple docstring'''




          if self.is_empty():
                 raise IndexError("remove_first from empty list")
          return self._delete(self._trailer._prev)














"""simple docstring"""





def     A(  snake_case_		):
       """simple docstring"""





       if not isinstance(snake_case_						,       snake_case_		):
              raise ValueError("Input series is not valid, valid series - [1, 2/3, 2]"		)
       if len(snake_case_		) == 0:
              raise ValueError("Input list must be a non empty list"		)
       if len(snake_case_		) == 1 and series[0] != 0:
              return True
       lowercase__:    str        =      []
       lowercase__:    Optional[int]        =      len(snake_case_		)
       for i in range(0						,       snake_case_		):
              if series[i] == 0:
                     raise ValueError("Input series cannot have 0 as an element"		)
              rec_series.append(1 / series[i]		)
       lowercase__:    Optional[int]        =      rec_series[1] - rec_series[0]
       for index in range(2						,       snake_case_		):
              if rec_series[index] - rec_series[index - 1] != common_diff:
                     return False
       return True






def     A(  snake_case_		):
       """simple docstring"""





       if not isinstance(snake_case_						,       snake_case_		):
              raise ValueError("Input series is not valid, valid series - [2, 4, 6]"		)
       if len(snake_case_		) == 0:
              raise ValueError("Input list must be a non empty list"		)
       lowercase__:    Optional[int]        =      0
       for val in series:
              answer += 1 / val
       return len(snake_case_		) / answer


if __name__ == "__main__":
  import doctest

  doctest.testmod()






