



'''simple docstring'''





def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase							,   UpperCamelCase      ):



    """simple docstring"""





    while a != 0:
        lowerCAmelCase__				,       lowerCAmelCase__			:  Dict											= b % a, a
    return b




def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase							,   UpperCamelCase      ):



    """simple docstring"""





    if gcd(UpperCamelCase							,   UpperCamelCase      ) != 1:
        lowerCAmelCase__			:  Any											= f"""mod inverse of {a!r} and {m!r} does not exist"""
        raise ValueError(UpperCamelCase      )
    lowerCAmelCase__				,       lowerCAmelCase__				,       lowerCAmelCase__			:  Optional[int]											= 1, 0, a
    lowerCAmelCase__				,       lowerCAmelCase__				,       lowerCAmelCase__			:  int											= 0, 1, m
    while va != 0:
        lowerCAmelCase__			:  Any											= ua // va
        lowerCAmelCase__				,       lowerCAmelCase__				,       lowerCAmelCase__				,       lowerCAmelCase__				,       lowerCAmelCase__				,       lowerCAmelCase__			:  str											= (ua - q * va), (ua - q * va), (ua - q * va), va, va, va
    return ua % m







'''simple docstring'''





class 	lowerCAmelCase_:
  '''simple docstring'''




  def __init__(   self  ,__UpperCAmelCase				)   ->		Tuple:
      lowerCAmelCase__			:  Union[str, Any]											= n
      lowerCAmelCase__			:  int											= [None] * self.n
      lowerCAmelCase__			:  Union[str, Any]											= 0  # index of the first element
      lowerCAmelCase__			:  Union[str, Any]											= 0
      lowerCAmelCase__			:  Union[str, Any]											= 0




  def __len__(   self				)   ->		int:
      return self.size




  def 							UpperCAmelCase_     (   self				)   ->		bool:
      return self.size == 0




  def 							UpperCAmelCase_     (   self				)   ->		Optional[Any]:
      return False if self.is_empty() else self.array[self.front]




  def 							UpperCAmelCase_     (   self  ,__UpperCAmelCase				)   ->		Union[str, Any]:
      if self.size >= self.n:
          raise Exception("""QUEUE IS FULL"""				)

      lowerCAmelCase__			:  str											= data
      lowerCAmelCase__			:  List[str]											= (self.rear + 1) % self.n
      self.size += 1
      return self






  def 							UpperCAmelCase_     (   self				)   ->		int:
      if self.size == 0:
          raise Exception("""UNDERFLOW"""				)

      lowerCAmelCase__			:  int											= self.array[self.front]
      lowerCAmelCase__			:  Optional[Any]											= None
      lowerCAmelCase__			:  int											= (self.front + 1) % self.n
      self.size -= 1
      return temp


