class 						_SCREAMING_SNAKE_CASE				:






		"""simple docstring"""







		def __init__(      self     :					Tuple	,       __SCREAMING_SNAKE_CASE     :					Optional[Any] ):






					"""simple docstring"""
					_snake_case														=   data
					_snake_case														=   None
					_snake_case														=   None







		def __str__(      self     :					str ):






					"""simple docstring"""
					return F'{self.data}'

class 						_SCREAMING_SNAKE_CASE				:






		"""simple docstring"""







		def __init__(      self     :					int ):






					"""simple docstring"""
					_snake_case														=   None
					_snake_case														=   None



		def __iter__(      self     :					Optional[int] ):






					"""simple docstring"""
					_snake_case														=   self.head
					while node:
								yield node.data
								_snake_case														=   node.next



		def __str__(      self     :					Any ):






					"""simple docstring"""
					return "->".join([str(__SCREAMING_SNAKE_CASE ) for item in self] )



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






					"""simple docstring"""
					return sum(1 for _ in self )



		def 					_a					(      self     :					Tuple	,       __SCREAMING_SNAKE_CASE     :					Optional[int] ):






					"""simple docstring"""
					self.insert_at_nth(0	,       __SCREAMING_SNAKE_CASE )



		def 					_a					(      self     :					Any	,       __SCREAMING_SNAKE_CASE     :					str ):






					"""simple docstring"""
					self.insert_at_nth(len(self )	,       __SCREAMING_SNAKE_CASE )



		def 					_a					(      self     :					Tuple	,       __SCREAMING_SNAKE_CASE     :					int	,       __SCREAMING_SNAKE_CASE     :					Dict ):






					"""simple docstring"""
					_snake_case														=   len(self )

					if not 0 <= index <= length:
								raise IndexError("list index out of range" )
					_snake_case														=   Node(__SCREAMING_SNAKE_CASE )
					if self.head is None:
								_snake_case														=   _snake_case														=   new_node
					elif index == 0:
								_snake_case														=   new_node
								_snake_case														=   self.head
								_snake_case														=   new_node
					elif index == length:
								_snake_case														=   new_node
								_snake_case														=   self.tail
								_snake_case														=   new_node
					else:
								_snake_case														=   self.head
								for _ in range(0	,       __SCREAMING_SNAKE_CASE ):
											_snake_case														=   temp.next
								_snake_case														=   new_node
								_snake_case														=   temp.previous
								_snake_case														=   temp
								_snake_case														=   new_node



		def 					_a					(      self     :					Union[str, Any] ):






					"""simple docstring"""
					return self.delete_at_nth(0 )



		def 					_a					(      self     :					int ):






					"""simple docstring"""
					return self.delete_at_nth(len(self ) - 1 )



		def 					_a					(      self     :					Optional[int]	,       __SCREAMING_SNAKE_CASE     :					int ):






					"""simple docstring"""
					_snake_case														=   len(self )

					if not 0 <= index <= length - 1:
								raise IndexError("list index out of range" )
					_snake_case														=   self.head  # default first node
					if length == 1:
								_snake_case														=   _snake_case														=   None
					elif index == 0:
								_snake_case														=   self.head.next
								_snake_case														=   None
					elif index == length - 1:
								_snake_case														=   self.tail
								_snake_case														=   self.tail.previous
								_snake_case														=   None
					else:
								_snake_case														=   self.head
								for _ in range(0	,       __SCREAMING_SNAKE_CASE ):
											_snake_case														=   temp.next
								_snake_case														=   temp
								_snake_case														=   temp.previous
								_snake_case														=   temp.next
					return delete_node.data



		def 					_a					(      self     :					int	,       __SCREAMING_SNAKE_CASE     :					int ):






					"""simple docstring"""
					_snake_case														=   self.head

					while current.data != data:  # Find the position to delete
								if current.next:
											_snake_case														=   current.next
								else:  # We have reached the end an no value matches
											raise ValueError("No data matching given value" )

					if current == self.head:
								self.delete_head()

					elif current == self.tail:
								self.delete_tail()

					else:  # Before: 1 <--> 2(current) <--> 3
								_snake_case														=   current.next  # 1 --> 3
								_snake_case														=   current.previous  # 1 <--> 3
					return data







		def 					_a					(      self     :					List[Any] ):






					"""simple docstring"""
					return len(self ) == 0






def  UpperCAmelCase__(    ):



			"""simple docstring"""





			_snake_case														=   DoublyLinkedList()
			assert linked_list.is_empty() is True
			assert str(lowerCamelCase_	) == ""

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

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

			for i in range(10	):
						assert len(lowerCamelCase_	) == i
						linked_list.insert_at_nth(lowerCamelCase_				,						i + 1	)
			assert str(lowerCamelCase_	) == "->".join(str(lowerCamelCase_	) for i in range(1				,						11	)	)

			linked_list.insert_at_head(0	)
			linked_list.insert_at_tail(11	)
			assert str(lowerCamelCase_	) == "->".join(str(lowerCamelCase_	) for i in range(0				,						12	)	)

			assert linked_list.delete_head() == 0
			assert linked_list.delete_at_nth(9	) == 10
			assert linked_list.delete_tail() == 11
			assert len(lowerCamelCase_	) == 9
			assert str(lowerCamelCase_	) == "->".join(str(lowerCamelCase_	) for i in range(1				,						10	)	)


if __name__ == "__main__":
			from doctest import testmod

			testmod()


def  UpperCAmelCase__(    lowerCamelCase_ = 1000	):



			"""simple docstring"""





			return sum(i for i in range(lowerCamelCase_	) if i % 3 == 0 or i % 5 == 0	)


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

