
'''simple docstring'''
from __future__ import annotations

def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    assert n > 1 and a > 0 and greatest_common_divisor(__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							) == 1
    ((snake_case_)      ,			(snake_case_)      ,			(snake_case_))			:     Dict        =    extended_gcd(__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							)  # Implemented below
    snake_case_			:     str        =    (b * s) % n
    return x

def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    ((snake_case_)      ,			(snake_case_))			:     List[Any]        =    extended_euclid(__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							)  # Implemented below
    if b < 0:
        snake_case_			:     Tuple        =    (b % n + n) % n
    return b

def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    snake_case_			:     Tuple        =    invert_modulo(__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							)
    snake_case_			:     int        =    (b * s) % n
    return x

def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    assert a >= 0 and b >= 0

    if b == 0:
        snake_case_      ,			snake_case_      ,			snake_case_			:     str        =    a, 1, 0
    else:
        ((snake_case_)      ,			(snake_case_)      ,			(snake_case_))			:     Union[str, Any]        =    extended_gcd(__SCREAMING_SNAKE_CASE,		a % b							)
        snake_case_			:     Optional[int]        =    q
        snake_case_			:     List[Any]        =    p - q * (a // b)

    assert a % d == 0 and b % d == 0
    assert d == a * x + b * y

    return (d, x, y)

def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    if b == 0:
        return (1, 0)
    ((snake_case_)      ,			(snake_case_))			:     List[str]        =    extended_euclid(__SCREAMING_SNAKE_CASE,		a % b							)
    snake_case_			:     Dict        =    a // b
    return (y, x - k * y)

def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    if a < b:
        snake_case_      ,			snake_case_			:     List[str]        =    b, a

    while a % b != 0:
        snake_case_      ,			snake_case_			:     Union[str, Any]        =    b, a % b

    return b


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

  testmod(name="modular_division", verbose=True)
  testmod(name="modular_division2", verbose=True)
  testmod(name="invert_modulo", verbose=True)
  testmod(name="extended_gcd", verbose=True)
  testmod(name="extended_euclid", verbose=True)
  testmod(name="greatest_common_divisor", verbose=True)






'''simple docstring'''
def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    if number != int(__SCREAMING_SNAKE_CASE							):
        raise ValueError("factorial() only accepts integral values"							)
    if number < 0:
        raise ValueError("factorial() not defined for negative values"							)
    snake_case_			:     int        =    1
    for i in range(1,		number + 1							):
        value *= i
    return value

def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    if not isinstance(__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							):
        raise ValueError("factorial() only accepts integral values"							)
    if n < 0:
        raise ValueError("factorial() not defined for negative values"							)
    return 1 if n == 0 or n == 1 else n * factorial(n - 1							)


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  a_           =    int(input("Enter a positive integer: ").strip() or 0)
  print(f"""factorial{n} is {factorial(n)}""")




