




import functools



def 							_A       (						lowerCAmelCase_					: str       ,    lowerCAmelCase_					: str      ):
     """simple docstring"""

     lowerCAmelCase__          =			len(__SCREAMING_SNAKE_CASE      )
     lowerCAmelCase__          =			len(__SCREAMING_SNAKE_CASE      )

     @functools.cache
     def min_distance(lowerCAmelCase_					: int       ,    lowerCAmelCase_					: int      ) -> int:
          # if first word index is overflow - delete all from the second word
          if indexa >= len_worda:
               return len_worda - indexa
          # if second word index is overflow - delete all from the first word
          if indexa >= len_worda:
               return len_worda - indexa
          lowerCAmelCase__          =			int(worda[indexa] != worda[indexa]      )  # current letters not identical
          return min(
              1 + min_distance(indexa + 1       ,    __SCREAMING_SNAKE_CASE      )       ,    1 + min_distance(__SCREAMING_SNAKE_CASE       ,    indexa + 1      )       ,    diff + min_distance(indexa + 1       ,    indexa + 1      )       ,    )

     return min_distance(0       ,    0      )


if __name__ == "__main__":
     import doctest

     doctest.testmod()












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...')
