





from __future__ import annotations

from collections.abc import Iterator
from typing import Any






class        snake_case_    :






  def __init__(							self			:					str       ,  _snake_case			:					Any      )->Tuple:






   '''simple docstring'''

   __lowerCAmelCase					:	Tuple      =       data
   __lowerCAmelCase					:	List[Any]      =       None






class        snake_case_    :






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






   '''simple docstring'''

   __lowerCAmelCase					:	int      =       None
   __lowerCAmelCase					:	Union[str, Any]      =       None






  def __iter__(							self			:					List[Any]      )->Iterator[Any]:






   '''simple docstring'''

   __lowerCAmelCase					:	Tuple      =       self.head
   while self.head:
    yield node.data
    __lowerCAmelCase					:	Optional[Any]      =       node.next
    if node == self.head:
     break






  def __len__(							self			:					Optional[int]      )->int:






   '''simple docstring'''

   return sum(1 for _ in self      )






  def __repr__(							self			:					List[Any]      )->str:






   '''simple docstring'''

   return "->".join(str(UpperCAmelCase__      ) for item in iter(self      )      )






  def 				UpperCAmelCase__						(							self			:					str       ,  _snake_case			:					Any      )->None:






   '''simple docstring'''

   self.insert_nth(len(self      )       ,  UpperCAmelCase__      )






  def 				UpperCAmelCase__						(							self			:					str       ,  _snake_case			:					Any      )->None:






   '''simple docstring'''

   self.insert_nth(0       ,  UpperCAmelCase__      )






  def 				UpperCAmelCase__						(							self			:					List[Any]       ,  _snake_case			:					int       ,  _snake_case			:					Any      )->None:






   '''simple docstring'''

   if index < 0 or index > len(self      ):
    raise IndexError("""list index out of range."""      )
   __lowerCAmelCase					:	Tuple      =       Node(UpperCAmelCase__      )
   if self.head is None:
    __lowerCAmelCase					:	Dict      =       new_node  # first node points itself
    __lowerCAmelCase					:	int      =       new_node
   elif index == 0:  # insert at head
    __lowerCAmelCase					:	Optional[Any]      =       self.head
    __lowerCAmelCase					:	List[Any]      =       new_node
   else:
    __lowerCAmelCase					:	List[str]      =       self.head
    for _ in range(index - 1      ):
     __lowerCAmelCase					:	List[Any]      =       temp.next
    __lowerCAmelCase					:	str      =       temp.next
    __lowerCAmelCase					:	Dict      =       new_node
    if index == len(self      ) - 1:  # insert at tail
     __lowerCAmelCase					:	int      =       new_node






  def 				UpperCAmelCase__						(							self			:					Tuple      )->Optional[Any]:






   '''simple docstring'''

   return self.delete_nth(0      )






  def 				UpperCAmelCase__						(							self			:					Optional[int]      )->Any:






   '''simple docstring'''

   return self.delete_nth(len(self      ) - 1      )






  def 				UpperCAmelCase__						(							self			:					str       ,  _snake_case			:					int = 0      )->Any:






   '''simple docstring'''

   if not 0 <= index < len(self      ):
    raise IndexError("""list index out of range."""      )
   __lowerCAmelCase					:	int      =       self.head
   if self.head == self.tail:  # just one node
    __lowerCAmelCase					:	int      =       None
   elif index == 0:  # delete head node
    __lowerCAmelCase					:	Optional[int]      =       self.tail.next.next
    __lowerCAmelCase					:	Tuple      =       self.head.next
   else:
    __lowerCAmelCase					:	Tuple      =       self.head
    for _ in range(index - 1      ):
     __lowerCAmelCase					:	str      =       temp.next
    __lowerCAmelCase					:	str      =       temp.next
    __lowerCAmelCase					:	str      =       temp.next.next
    if index == len(self      ) - 1:  # delete at tail
     __lowerCAmelCase					:	Tuple      =       temp
   return delete_node.data






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






   '''simple docstring'''

   return len(self      ) == 0






def 	_SCREAMING_SNAKE_CASE		(      )      ->   List[Any]:
 __lowerCAmelCase					:	List[Any]      =       CircularLinkedList()
 assert len(SCREAMING_SNAKE_CASE   ) == 0
 assert circular_linked_list.is_empty() is True
 assert str(SCREAMING_SNAKE_CASE   ) == ""

 try:
  circular_linked_list.delete_front()
  raise AssertionError  # This should not happen
 except IndexError:
  assert True  # This should happen

 try:
  circular_linked_list.delete_tail()
  raise AssertionError  # This should not happen
 except IndexError:
  assert True  # This should happen

 try:
  circular_linked_list.delete_nth(-1   )
  raise AssertionError
 except IndexError:
  assert True

 try:
  circular_linked_list.delete_nth(0   )
  raise AssertionError
 except IndexError:
  assert True

 assert circular_linked_list.is_empty() is True
 for i in range(5   ):
  assert len(SCREAMING_SNAKE_CASE   ) == i
  circular_linked_list.insert_nth(SCREAMING_SNAKE_CASE   ,   i + 1   )
 assert str(SCREAMING_SNAKE_CASE   ) == "->".join(str(SCREAMING_SNAKE_CASE   ) for i in range(1   ,   6   )   )

 circular_linked_list.insert_tail(6   )
 assert str(SCREAMING_SNAKE_CASE   ) == "->".join(str(SCREAMING_SNAKE_CASE   ) for i in range(1   ,   7   )   )
 circular_linked_list.insert_head(0   )
 assert str(SCREAMING_SNAKE_CASE   ) == "->".join(str(SCREAMING_SNAKE_CASE   ) for i in range(0   ,   7   )   )

 assert circular_linked_list.delete_front() == 0
 assert circular_linked_list.delete_tail() == 6
 assert str(SCREAMING_SNAKE_CASE   ) == "->".join(str(SCREAMING_SNAKE_CASE   ) for i in range(1   ,   6   )   )
 assert circular_linked_list.delete_nth(2   ) == 3

 circular_linked_list.insert_nth(2   ,   3   )
 assert str(SCREAMING_SNAKE_CASE   ) == "->".join(str(SCREAMING_SNAKE_CASE   ) for i in range(1   ,   6   )   )

 assert circular_linked_list.is_empty() is False


if __name__ == "__main__":
      import doctest

      doctest.testmod()






def 	_SCREAMING_SNAKE_CASE		(      SCREAMING_SNAKE_CASE		:list[int]   )      ->   int:
 if not numbers:
  return 0

 if not isinstance(SCREAMING_SNAKE_CASE   ,   (list, tuple)   ) or not all(
     isinstance(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   ) for number in numbers   ):
  raise ValueError("""numbers must be an iterable of integers"""   )

 __lowerCAmelCase					:	int      =       numbers[0]

 for i in range(1   ,   len(SCREAMING_SNAKE_CASE   )   ):
  # update the maximum and minimum subarray products
  __lowerCAmelCase					:	List[str]      =       numbers[i]
  if number < 0:
   __lowerCAmelCase ,					__lowerCAmelCase					:	Union[str, Any]      =       min_till_now, max_till_now
  __lowerCAmelCase					:	Optional[int]      =       max(SCREAMING_SNAKE_CASE   ,   max_till_now * number   )
  __lowerCAmelCase					:	List[Any]      =       min(SCREAMING_SNAKE_CASE   ,   min_till_now * number   )

  # update the maximum product found till now
  __lowerCAmelCase					:	List[str]      =       max(SCREAMING_SNAKE_CASE   ,   SCREAMING_SNAKE_CASE   )

 return max_prod