'''simple docstring'''

from __future__ import annotations


def __a			(						__lowerCamelCase      :    Dict			,		__lowerCamelCase      :    Optional[Any]			,		__lowerCamelCase      :    Union[str, Any]					)						->				Union[str, Any]:
      '''simple docstring'''


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


def __a			(						__lowerCamelCase      :    int			,		__lowerCamelCase      :    List[Any]					)						->				int:
      '''simple docstring'''


      (lowercase_)     			=   extended_euclid(__SCREAMING_SNAKE_CASE			,		__SCREAMING_SNAKE_CASE					)  # Implemented below
      if b < 0:
            lowercase_     			=   (b % n + n) % n
      return b


def __a			(						__lowerCamelCase      :    str			,		__lowerCamelCase      :    List[str]			,		__lowerCamelCase      :    Tuple					)						->				Any:
      '''simple docstring'''


      lowercase_     			=   invert_modulo(__SCREAMING_SNAKE_CASE			,		__SCREAMING_SNAKE_CASE					)
      lowercase_     			=   (b * s) % n
      return x


def __a			(						__lowerCamelCase      :    Union[str, Any]			,		__lowerCamelCase      :    Tuple					)						->				Optional[int]:
      '''simple docstring'''


      assert a >= 0 and b >= 0

      if b == 0:
            lowercase_     			=   a, 1, 0
      else:
            (lowercase_)     			=   extended_gcd(__SCREAMING_SNAKE_CASE			,		a % b					)
            lowercase_     			=   q
            lowercase_     			=   p - q * (a // b)

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

      return (d, x, y)


def __a			(						__lowerCamelCase      :    int			,		__lowerCamelCase      :    Any					)						->				str:
      '''simple docstring'''


      if b == 0:
            return (1, 0)
      (lowercase_)     			=   extended_euclid(__SCREAMING_SNAKE_CASE			,		a % b					)
      lowercase_     			=   a // b
      return (y, x - k * y)


def __a			(						__lowerCamelCase      :    Optional[int]			,		__lowerCamelCase      :    List[str]					)						->				int:
      '''simple docstring'''


      if a < b:
            lowercase_     			=   b, a

      while a % b != 0:
            lowercase_     			=   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)}""")




