



"""simple docstring"""






from __future__ import annotations

from typing import Generic, TypeVar

__UpperCAmelCase      :      int   					=					TypeVar('T')

class 	__lowerCAmelCase							(Generic[T]  ):


					'''simple docstring'''


					def __init__(      self    ,       a   ):




										"""simple docstring"""





										snake_case_						:int								=						data  # Assign data
										snake_case_						:Node[T] | None								=						None  # Initialize next as null
										snake_case_						:Node[T] | None								=						None  # Initialize prev as null



class 	__lowerCAmelCase							(Generic[T]  ):


					'''simple docstring'''


					def __init__(      self   ):




										"""simple docstring"""





										snake_case_						:Node[T] | None								=						None







					def 		_a (      self    ,       a   ):




										"""simple docstring"""





										if self.head is None:
															snake_case_						:int								=						Node(a   )
										else:
															snake_case_						:Optional[Any]								=						Node(a   )
															snake_case_						:Any								=						new_node
															snake_case_						:Any								=						self.head
															snake_case_						:str								=						None
															snake_case_						:Dict								=						new_node







					def 		_a (      self   ):




										"""simple docstring"""





										if self.head is None:
															return None
										else:
															assert self.head is not None
															snake_case_						:List[Any]								=						self.head.data
															snake_case_						:Tuple								=						self.head.next
															if self.head is not None:
																				snake_case_						:Optional[Any]								=						None
															return temp







					def 		_a (      self   ):




										"""simple docstring"""





										return self.head.data if self.head is not None else None







					def __len__(      self   ):




										"""simple docstring"""





										snake_case_						:Union[str, Any]								=						self.head
										snake_case_						:int								=						0
										while temp is not None:
															count += 1
															snake_case_						:List[Any]								=						temp.next
										return count







					def 		_a (      self   ):




										"""simple docstring"""





										return self.head is None







					def 		_a (      self   ):




										"""simple docstring"""





										print("stack elements are:"   )
										snake_case_						:Optional[Any]								=						self.head
										while temp is not None:
															print(temp.data    ,       end="->"   )
															snake_case_						:List[str]								=						temp.next


# Code execution starts here
if __name__ == "__main__":
				# Start with the empty stack
				__UpperCAmelCase      :      Stack[int]   					=					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())






"""simple docstring"""






def      A      (			_A,     _A							):




					"""simple docstring"""
					if n == 0:
										return 1

					elif n % 2 == 1:
										return binary_exponentiation(_A,     n - 1							) * a

					else:
										snake_case_						:Optional[int]								=						binary_exponentiation(_A,     n / 2							)
										return b * b


if __name__ == "__main__":
				try:
								__UpperCAmelCase      :      str   					=					int(input('Enter Base : ').strip())
								__UpperCAmelCase      :      Any   					=					int(input('Enter Power : ').strip())
				except ValueError:
								print('Invalid literal for integer')

				__UpperCAmelCase      :      Optional[int]   					=					binary_exponentiation(BASE, POWER)
				print(F'''{BASE}^({POWER}) : {RESULT}''')

