"""simple docstring"""




from __future__ import annotations

from typing import Any

class       a_      :




					def __init__(	self						:     Any  ,						snake_case__						:     List[str] = 6     ):
							lowerCAmelCase__        =   None
							lowerCAmelCase__        =   None
							self.create_linked_list(__UpperCamelCase     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     int  ,						snake_case__						:     int     ):
							lowerCAmelCase__        =   Node()
							lowerCAmelCase__        =   current_node
							lowerCAmelCase__        =   current_node
							lowerCAmelCase__        =   current_node
							for _ in range(1  ,						__UpperCamelCase     ):
									lowerCAmelCase__        =   Node()
									lowerCAmelCase__        =   current_node
									lowerCAmelCase__        =   previous_node
									lowerCAmelCase__        =   current_node
							lowerCAmelCase__        =   self.front
							lowerCAmelCase__        =   previous_node




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Union[str, Any]     ):
							return (
							    self.front == self.rear
							    and self.front is not None
							    and self.front.data is None
							)




					def 						_SCREAMING_SNAKE_CASE						(	self						:     List[Any]     ):
							self.check_can_perform_operation()
							return self.front.data if self.front else None




					def 						_SCREAMING_SNAKE_CASE						(	self						:     int  ,						snake_case__						:     List[Any]     ):


							if self.rear is None:
									return

							self.check_is_full()
							if not self.is_empty():
									lowerCAmelCase__        =   self.rear.next
							if self.rear:
									lowerCAmelCase__        =   data




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Tuple     ):
							self.check_can_perform_operation()
							if self.rear is None or self.front is None:
									return None
							if self.front == self.rear:
									lowerCAmelCase__        =   self.front.data
									lowerCAmelCase__        =   None
									return data

							lowerCAmelCase__        =   self.front
							lowerCAmelCase__        =   old_front.next
							lowerCAmelCase__        =   old_front.data
							lowerCAmelCase__        =   None
							return data




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Optional[int]     ):


							if self.is_empty():
									raise Exception("""Empty Queue"""     )




					def 						_SCREAMING_SNAKE_CASE						(	self						:     Tuple     ):


							if self.rear and self.rear.next == self.front:
									raise Exception("""Full Queue"""     )

class       a_      :




					def __init__(	self						:     Any     ):
							lowerCAmelCase__        =   None
							lowerCAmelCase__        =   None
							lowerCAmelCase__        =   None


if __name__ == "__main__":
			import doctest

			doctest.testmod()





"""simple docstring"""




from math import pi, sqrt







def 							_UpperCAmelCase		(       lowerCamelCase__     ):





		"""simple docstring"""




		if num <= 0:
				raise ValueError("""math domain error"""     )
		if num > 1_71.5:
				raise OverflowError("""math range error"""     )
		elif num - int(lowerCamelCase__     ) not in (0, 0.5):
				raise NotImplementedError("""num must be an integer or a half-integer"""     )
		elif num == 0.5:
				return sqrt(lowerCamelCase__     )
		else:
				return 1.0 if num == 1 else (num - 1) * gamma(num - 1     )







def 							_UpperCAmelCase		(       ):





		"""simple docstring"""




		assert gamma(0.5     ) == sqrt(lowerCamelCase__     )
		assert gamma(1     ) == 1.0
		assert gamma(2     ) == 1.0


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

			testmod()
			__lowerCAmelCase    :							Dict													=						1.0
			while num:
						__lowerCAmelCase    :							Any													=						float(input("Gamma of: "))
						print(F"gamma({num}) = {gamma(num)}")
						print("\nEnter 0 to exit...")




