from __future__ import annotations

from typing import Generic, TypeVar

UpperCAmelCase      		=					TypeVar('''T''')




class  __lowerCAmelCase	(							Generic[T]    ):



 '''simple docstring'''

 def __init__(      self							:		Union[str, Any]							,      lowerCamelCase							:		T	)			->				List[str]:
        _UpperCamelCase  :							Any	    =	data  # Assign data
        _UpperCamelCase  :							Node[T] | None	    =	None  # Initialize next as null
        _UpperCamelCase  :							Node[T] | None	    =	None  # Initialize prev as null







class  __lowerCAmelCase	(							Generic[T]    ):



 '''simple docstring'''

 def __init__(      self							:		Optional[int]	)			->				None:
        _UpperCamelCase  :							Node[T] | None	    =	None

 def        __snake_case       (      self							:		int							,      lowerCamelCase							:		T	)			->				None:
        if self.head is None:
               _UpperCamelCase  :							List[Any]	    =	Node(lowerCamelCase	)
        else:
               _UpperCamelCase  :							Optional[Any]	    =	Node(lowerCamelCase	)
               _UpperCamelCase  :							Optional[Any]	    =	new_node
               _UpperCamelCase  :							List[str]	    =	self.head
               _UpperCamelCase  :							List[Any]	    =	None
               _UpperCamelCase  :							List[str]	    =	new_node

 def        __snake_case       (      self							:		Union[str, Any]	)			->				T | None:
        if self.head is None:
               return None
        else:
               assert self.head is not None
               _UpperCamelCase  :							Union[str, Any]	    =	self.head.data
               _UpperCamelCase  :							List[Any]	    =	self.head.next
               if self.head is not None:
                      _UpperCamelCase  :							List[Any]	    =	None
               return temp

 def        __snake_case       (      self							:		Tuple	)			->				T | None:
        return self.head.data if self.head is not None else None

 def __len__(      self							:		Optional[int]	)			->				int:
        _UpperCamelCase  :							Dict	    =	self.head
        _UpperCamelCase  :							Dict	    =	0
        while temp is not None:
               count += 1
               _UpperCamelCase  :							Optional[Any]	    =	temp.next
        return count

 def        __snake_case       (      self							:		Optional[Any]	)			->				bool:
        return self.head is None

 def        __snake_case       (      self							:		Union[str, Any]	)			->				None:
        print('stack elements are:'	)
        _UpperCamelCase  :							Optional[int]	    =	self.head
        while temp is not None:
               print(temp.data							,      end='->'	)
               _UpperCamelCase  :							str	    =	temp.next


# Code execution starts here
if __name__ == "__main__":
 # Start with the empty stack
 UpperCAmelCase      		=					Stack()

 # Insert 4 at the beginning. So stack becomes 4->None
 print('''Stack operations using Doubly LinkedList''')
 stack.push(4)

 # Insert 5 at the beginning. So stack becomes 4->5->None
 stack.push(5)

 # Insert 6 at the beginning. So stack becomes 4->5->6->None
 stack.push(6)

 # Insert 7 at the beginning. So stack becomes 4->5->6->7->None
 stack.push(7)

 # Print the stack
 stack.print_stack()

 # Print the top element
 print('''\nTop element is ''', stack.top())

 # Print the stack size
 print('''Size of the stack is ''', len(stack))

 # pop the top element
 stack.pop()

 # pop the top element
 stack.pop()

 # two elements have now been popped off
 stack.print_stack()

 # Print True if the stack is empty else False
 print('''\nstack is empty:''', stack.is_empty())








def 						snake_case__							(       __lowercase = 1_0_0_0							)		->		int:







						"""simple docstring"""

						A__						:				int         =			0
						A__						:				Optional[int]         =			0
						while 1:
												num += 3
												if num >= n:
																		break
												total += num
												num += 2
												if num >= n:
																		break
												total += num
												num += 1
												if num >= n:
																		break
												total += num
												num += 3
												if num >= n:
																		break
												total += num
												num += 1
												if num >= n:
																		break
												total += num
												num += 2
												if num >= n:
																		break
												total += num
												num += 3
												if num >= n:
																		break
												total += num
						return total


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