


from __future__ import annotations

def       _a	(					SCREAMING_SNAKE_CASE						:					int     ,			SCREAMING_SNAKE_CASE						:					int     ,			SCREAMING_SNAKE_CASE						:					int  ):







 """simple docstring"""



 assert n > 1 and a > 0 and greatest_common_divisor(SCREAMING_SNAKE_CASE     ,			SCREAMING_SNAKE_CASE  ) == 1
 ((UpperCamelCase__)							,					(UpperCamelCase__)							,					(UpperCamelCase__))       :     Optional[Any] 							= extended_gcd(SCREAMING_SNAKE_CASE     ,			SCREAMING_SNAKE_CASE  )  # Implemented below
 UpperCamelCase__       :     Dict 							= (b * s) % n
 return x

def       _a	(					SCREAMING_SNAKE_CASE						:					int     ,			SCREAMING_SNAKE_CASE						:					int  ):







 """simple docstring"""



 ((UpperCamelCase__)							,					(UpperCamelCase__))       :     Tuple 							= extended_euclid(SCREAMING_SNAKE_CASE     ,			SCREAMING_SNAKE_CASE  )  # Implemented below
 if b < 0:
  UpperCamelCase__       :     Optional[Any] 							= (b % n + n) % n
 return b

def       _a	(					SCREAMING_SNAKE_CASE						:					int     ,			SCREAMING_SNAKE_CASE						:					int     ,			SCREAMING_SNAKE_CASE						:					int  ):







 """simple docstring"""



 UpperCamelCase__       :     Tuple 							= invert_modulo(SCREAMING_SNAKE_CASE     ,			SCREAMING_SNAKE_CASE  )
 UpperCamelCase__       :     Tuple 							= (b * s) % n
 return x

def       _a	(					SCREAMING_SNAKE_CASE						:					int     ,			SCREAMING_SNAKE_CASE						:					int  ):







 """simple docstring"""



 assert a >= 0 and b >= 0

 if b == 0:
  UpperCamelCase__							,					UpperCamelCase__							,					UpperCamelCase__       :     Optional[Any] 							= a, 1, 0
 else:
  ((UpperCamelCase__)							,					(UpperCamelCase__)							,					(UpperCamelCase__))       :     str 							= extended_gcd(SCREAMING_SNAKE_CASE     ,			a % b  )
  UpperCamelCase__       :     Union[str, Any] 							= q
  UpperCamelCase__       :     Tuple 							= p - q * (a // b)

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

 return (d, x, y)

def       _a	(					SCREAMING_SNAKE_CASE						:					int     ,			SCREAMING_SNAKE_CASE						:					int  ):







 """simple docstring"""



 if b == 0:
  return (1, 0)
 ((UpperCamelCase__)							,					(UpperCamelCase__))       :     int 							= extended_euclid(SCREAMING_SNAKE_CASE     ,			a % b  )
 UpperCamelCase__       :     Dict 							= a // b
 return (y, x - k * y)

def       _a	(					SCREAMING_SNAKE_CASE						:					int     ,			SCREAMING_SNAKE_CASE						:					int  ):







 """simple docstring"""



 if a < b:
  UpperCamelCase__							,					UpperCamelCase__       :     Optional[Any] 							= b, a

 while a % b != 0:
  UpperCamelCase__							,					UpperCamelCase__       :     Optional[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)






from hashlib import mda, shaaaa

__UpperCamelCase							:							Dict    							=					(shaaaa, mda)

class    __magic_name__						:


     def __init__(   self				:  Optional[Any]				,						lowerCamelCase__				:  int = 8      )	->   None:





      '''simple docstring'''






      UpperCamelCase__       :     int 							= 0b0
      UpperCamelCase__       :     Optional[int] 							= size


     def   UpperCAmelCase__						(   self				:  Tuple				,						lowerCamelCase__				:  str      )	->   None:





      '''simple docstring'''






      UpperCamelCase__       :     Union[str, Any] 							= self.hash_(lowerCamelCase__      )
      self.bitarray |= h


     def   UpperCAmelCase__						(   self				:  Any				,						lowerCamelCase__				:  str      )	->   bool:





      '''simple docstring'''






      UpperCamelCase__       :     Any 							= self.hash_(lowerCamelCase__      )
      return (h & self.bitarray) == h


     def __contains__(   self				:  Any				,						lowerCamelCase__				:  str      )	->   bool:





      '''simple docstring'''






      return self.exists(lowerCamelCase__      )


     def   UpperCAmelCase__						(   self				:  Union[str, Any]				,						lowerCamelCase__				:  int      )	->   str:





      '''simple docstring'''






      UpperCamelCase__       :     Optional[int] 							= bin(lowerCamelCase__      )[2:]
      return res.zfill(self.size      )


     @property
     def   UpperCAmelCase__						(   self				:  Tuple      )	->   str:





      '''simple docstring'''






      return self.format_bin(self.bitarray      )


     def   UpperCAmelCase__						(   self				:  int				,						lowerCamelCase__				:  str      )	->   int:





      '''simple docstring'''






      UpperCamelCase__       :     Union[str, Any] 							= 0b0
      for func in HASH_FUNCTIONS:
       UpperCamelCase__       :     Optional[Any] 							= (
           int.from_bytes(func(value.encode()      ).digest()				,						'''little'''      ) % self.size
       )
       res |= 2**position
      return res


     def   UpperCAmelCase__						(   self				:  Union[str, Any]				,						lowerCamelCase__				:  str      )	->   str:





      '''simple docstring'''






      return self.format_bin(self.hash_(lowerCamelCase__      )      )


     @property
     def   UpperCAmelCase__						(   self				:  str      )	->   float:





      '''simple docstring'''






      UpperCamelCase__       :     Tuple 							= bin(self.bitarray      ).count('''1'''      )
      return (n_ones / self.size) ** len(lowerCamelCase__      )


