


from __future__ import annotations







def     snake_case_     (						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
				(_SCREAMING_SNAKE_CASE)				: Optional[Any]  	=   extended_gcd(SCREAMING_SNAKE_CASE__							,   SCREAMING_SNAKE_CASE__  )  # Implemented below
				_SCREAMING_SNAKE_CASE				: List[str]  	=   (b * s) % n
				return x







def     snake_case_     (						SCREAMING_SNAKE_CASE__							,   SCREAMING_SNAKE_CASE__  ):







				"""simple docstring"""





				(_SCREAMING_SNAKE_CASE)				: int  	=   extended_euclid(SCREAMING_SNAKE_CASE__							,   SCREAMING_SNAKE_CASE__  )  # Implemented below
				if b < 0:
								_SCREAMING_SNAKE_CASE				: List[str]  	=   (b % n + n) % n
				return b







def     snake_case_     (						SCREAMING_SNAKE_CASE__							,   SCREAMING_SNAKE_CASE__							,   SCREAMING_SNAKE_CASE__  ):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE				: Union[str, Any]  	=   invert_modulo(SCREAMING_SNAKE_CASE__							,   SCREAMING_SNAKE_CASE__  )
				_SCREAMING_SNAKE_CASE				: Any  	=   (b * s) % n
				return x







def     snake_case_     (						SCREAMING_SNAKE_CASE__							,   SCREAMING_SNAKE_CASE__  ):







				"""simple docstring"""





				assert a >= 0 and b >= 0

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

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

				return (d, x, y)







def     snake_case_     (						SCREAMING_SNAKE_CASE__							,   SCREAMING_SNAKE_CASE__  ):







				"""simple docstring"""





				if b == 0:
								return (1, 0)
				(_SCREAMING_SNAKE_CASE)				: List[str]  	=   extended_euclid(SCREAMING_SNAKE_CASE__							,   a % b  )
				_SCREAMING_SNAKE_CASE				: Optional[Any]  	=   a // b
				return (y, x - k * y)







def     snake_case_     (						SCREAMING_SNAKE_CASE__							,   SCREAMING_SNAKE_CASE__  ):







				"""simple docstring"""





				if a < b:
								_SCREAMING_SNAKE_CASE				: str  	=   b, a

				while a % b != 0:
								_SCREAMING_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'''


from ..utils import DummyObject, requires_backends





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[str]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   str   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Union[str, Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[str]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Tuple   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Optional[int]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Optional[int]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Optional[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Optional[int]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Tuple   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   str   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Dict   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   str   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Optional[int]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   str   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Tuple   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[str]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Optional[int]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[str]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   int   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Optional[int]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Tuple   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Dict   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Optional[int]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Union[str, Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[str]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Dict   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Tuple   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[str]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Any   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Dict   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Union[str, Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   Optional[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)





class 					lowercase__						(		metaclass=_snake_case      ):





							'''simple docstring'''


							A_							:   List[Any]   			=						["""tokenizers"""]






							def __init__(					self					,      *__snake_case					,      **__snake_case						):
											requires_backends(self					,      ["""tokenizers"""]						)




