




import os
import sys
from contextlib import contextmanager


# Windows only
if os.name == "nt":
     import ctypes
     import msvcrt  # noqa





     class 			__lowerCamelCase	(   ctypes.Structure   ):




         """simple docstring"""

         snake_case__ =				[("size", ctypes.c_int), ("visible", ctypes.c_byte)]



def 							_A       (						):
     """simple docstring"""

     if os.name == "nt":
          lowerCAmelCase__          =			CursorInfo()
          lowerCAmelCase__          =			ctypes.windll.kernelaa.GetStdHandle(-11      )
          ctypes.windll.kernelaa.GetConsoleCursorInfo(lowerCAmelCase_       ,    ctypes.byref(lowerCAmelCase_      )      )
          lowerCAmelCase__          =			False
          ctypes.windll.kernelaa.SetConsoleCursorInfo(lowerCAmelCase_       ,    ctypes.byref(lowerCAmelCase_      )      )
     elif os.name == "posix":
          sys.stdout.write("\033[?25l"      )
          sys.stdout.flush()



def 							_A       (						):
     """simple docstring"""

     if os.name == "nt":
          lowerCAmelCase__          =			CursorInfo()
          lowerCAmelCase__          =			ctypes.windll.kernelaa.GetStdHandle(-11      )
          ctypes.windll.kernelaa.GetConsoleCursorInfo(lowerCAmelCase_       ,    ctypes.byref(lowerCAmelCase_      )      )
          lowerCAmelCase__          =			True
          ctypes.windll.kernelaa.SetConsoleCursorInfo(lowerCAmelCase_       ,    ctypes.byref(lowerCAmelCase_      )      )
     elif os.name == "posix":
          sys.stdout.write("\033[?25h"      )
          sys.stdout.flush()






@contextmanager
def 							_A       (						):
     """simple docstring"""

     try:
          hide_cursor()
          yield
     finally:
          show_cursor()






from math import pi, sqrt



def 							_A       (						lowerCAmelCase_					: float      ):
     """simple docstring"""

     if num <= 0:
          raise ValueError("math domain error"      )
     if num > 171.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 							_A       (						):
     """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()
     UpperCamelCase								=					1.0
     while num:
          UpperCamelCase								=					float(input('Gamma of: '))
          print(F"""gamma({num}) = {gamma(num)}""")
          print('\nEnter 0 to exit...')
