





from math import pi, sqrt


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


def  SCREAMING_SNAKE_CASE   ( )    ->  List[str]:
    assert gamma(0.5				) == sqrt(__A				)
    assert gamma(1				) == 1.0
    assert gamma(2				) == 1.0


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

    testmod()
    _UpperCAmelCase       : List[str]			     =       1.0
    while num:
        _UpperCAmelCase       : int			     =       float(input("""Gamma of: """))
        print(F"""gamma({num}) = {gamma(num)}""")
        print("""\nEnter 0 to exit...""")












_UpperCAmelCase       : List[Any]			     =       {
    """meter""": """m""",
    """kilometer""": """km""",
    """megametre""": """Mm""",
    """gigametre""": """Gm""",
    """terametre""": """Tm""",
    """petametre""": """Pm""",
    """exametre""": """Em""",
    """zettametre""": """Zm""",
    """yottametre""": """Ym""",
}
# Exponent of the factor(meter)
_UpperCAmelCase       : Dict			     =       {
    """m""": 0,
    """km""": 3,
    """Mm""": 6,
    """Gm""": 9,
    """Tm""": 12,
    """Pm""": 15,
    """Em""": 18,
    """Zm""": 21,
    """Ym""": 24,
}


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase		,			_UpperCAmelCase		,			_UpperCAmelCase				)    ->  float:
    lowerCamelCase__					:   Dict      				=	from_type.lower().strip('s'				)
    lowerCamelCase__					:   Dict      				=	to_type.lower().strip('s'				)

    lowerCamelCase__					:   Dict      				=	UNIT_SYMBOL.get(_UpperCAmelCase		,			_UpperCAmelCase				)
    lowerCamelCase__					:   str      				=	UNIT_SYMBOL.get(_UpperCAmelCase		,			_UpperCAmelCase				)

    if from_sanitized not in METRIC_CONVERSION:
        lowerCamelCase__					:   List[Any]      				=	(
            F"""Invalid 'from_type' value: {from_type!r}.\n"""
            F"""Conversion abbreviations are: {", ".join(_UpperCAmelCase				)}"""
        )
        raise ValueError(_UpperCAmelCase				)
    if to_sanitized not in METRIC_CONVERSION:
        lowerCamelCase__					:   Optional[Any]      				=	(
            F"""Invalid 'to_type' value: {to_type!r}.\n"""
            F"""Conversion abbreviations are: {", ".join(_UpperCAmelCase				)}"""
        )
        raise ValueError(_UpperCAmelCase				)
    lowerCamelCase__					:   Any      				=	METRIC_CONVERSION[from_sanitized]
    lowerCamelCase__					:   Optional[int]      				=	METRIC_CONVERSION[to_sanitized]
    lowerCamelCase__					:   List[str]      				=	1

    if from_exponent > to_exponent:
        lowerCamelCase__					:   Dict      				=	from_exponent - to_exponent
    else:
        lowerCamelCase__					:   Dict      				=	-(to_exponent - from_exponent)

    return value * pow(10		,			_UpperCAmelCase				)


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

    testmod()





