





"""simple docstring"""


from math import pi, sqrt




def        lowercase__     (       lowercase_      )       ->		float:




      """simple docstring"""

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




def        lowercase__     (       )       ->		None:




      """simple docstring"""

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


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

  testmod()
  lowerCamelCase__						= 1.0
  while num:
    lowerCamelCase__						= float(input("Gamma of: "))
    print(f"""gamma({num}) = {gamma(num)}""")
    print("\nEnter 0 to exit...")







"""simple docstring"""


def        lowercase__     (       lowercase_      )       ->		list:




      """simple docstring"""

      if len(lowercase_      ) <= 1:
            return [tuple(lowercase_      )]

      _UpperCamelCase   :						Optional[Any]    =							[]

      def generate(lowercase_		,lowercase_      ):
            if k == 1:
                  res.append(tuple(arr[:]      )      )
                  return

            generate(k - 1		,lowercase_      )

            for i in range(k - 1      ):
                  if k % 2 == 0:  # k is even
                        _UpperCamelCase,	_UpperCamelCase   :						List[str]    =							arr[k - 1], arr[i]
                  else:  # k is odd
                        _UpperCamelCase,	_UpperCamelCase   :						int    =							arr[k - 1], arr[0]
                  generate(k - 1		,lowercase_      )

      generate(len(lowercase_      )		,lowercase_      )
      return res


if __name__ == "__main__":
  lowerCamelCase__						= input("Enter numbers separated by a comma:\n").strip()
  lowerCamelCase__						= [int(item) for item in user_input.split(",")]
  print(heaps(arr))
