


def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Any      ,					SCREAMING_SNAKE_CASE__      : List[Any]    ):
					return number | (1 << position)

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : str      ,					SCREAMING_SNAKE_CASE__      : int    ):
					return number & ~(1 << position)

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Union[str, Any]      ,					SCREAMING_SNAKE_CASE__      : Any    ):
					return number ^ (1 << position)

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Tuple      ,					SCREAMING_SNAKE_CASE__      : Any    ):
					return ((number >> position) & 1) == 1

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Optional[int]      ,					SCREAMING_SNAKE_CASE__      : int    ):
					return int((number & (1 << position)) != 0    )


if __name__ == "__main__":
			import doctest

			doctest.testmod()









from __future__ import annotations

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int    ):
     if b == 0:
          return (1, 0)
     ((__UpperCamelCase)							,				(__UpperCamelCase))   							=extended_euclid(SCREAMING_SNAKE_CASE__      ,					a % b    )
     __UpperCamelCase   							=a // b
     return (y, x - k * y)

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int    ):
     ((__UpperCamelCase)							,				(__UpperCamelCase))   							=extended_euclid(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    )
     __UpperCamelCase   							=na * na
     __UpperCamelCase   							=ra * x * na + ra * y * na
     return (n % m + m) % m

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int    ):
     ((__UpperCamelCase)							,				(__UpperCamelCase))   							=extended_euclid(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    )
     if b < 0:
          __UpperCamelCase   							=(b % n + n) % n
     return b

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int    ):
     __UpperCamelCase							,				__UpperCamelCase   							=invert_modulo(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    ), invert_modulo(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    )
     __UpperCamelCase   							=na * na
     __UpperCamelCase   							=ra * x * na + ra * y * na
     return (n % m + m) % m


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

   testmod(name='chinese_remainder_theorem', verbose=True)
   testmod(name='chinese_remainder_theorem2', verbose=True)
   testmod(name='invert_modulo', verbose=True)
   testmod(name='extended_euclid', verbose=True)





