




from __future__ import annotations



def      __lowerCAmelCase			(					UpperCamelCase	,      UpperCamelCase      )     ->	tuple[int, int]:
  if b == 0:
    return (1, 0)
  ((lowerCAmelCase__)       ,			(lowerCAmelCase__))				:  Union[str, Any]		       =     extended_euclid(UpperCamelCase	,      a % b      )
  lowerCAmelCase__				:  List[Any]		       =     a // b
  return (y, x - k * y)



def      __lowerCAmelCase			(					UpperCamelCase	,      UpperCamelCase	,      UpperCamelCase	,      UpperCamelCase      )     ->	int:
  ((lowerCAmelCase__)       ,			(lowerCAmelCase__))				:  Union[str, Any]		       =     extended_euclid(UpperCamelCase	,      UpperCamelCase      )
  lowerCAmelCase__				:  Dict		       =     na * na
  lowerCAmelCase__				:  Tuple		       =     ra * x * na + ra * y * na
  return (n % m + m) % m



def      __lowerCAmelCase			(					UpperCamelCase	,      UpperCamelCase      )     ->	int:
  ((lowerCAmelCase__)       ,			(lowerCAmelCase__))				:  Union[str, Any]		       =     extended_euclid(UpperCamelCase	,      UpperCamelCase      )
  if b < 0:
    lowerCAmelCase__				:  str		       =     (b % n + n) % n
  return b



def      __lowerCAmelCase			(					UpperCamelCase	,      UpperCamelCase	,      UpperCamelCase	,      UpperCamelCase      )     ->	int:
  lowerCAmelCase__       ,			lowerCAmelCase__				:  int		       =     invert_modulo(UpperCamelCase	,      UpperCamelCase      ), invert_modulo(UpperCamelCase	,      UpperCamelCase      )
  lowerCAmelCase__				:  int		       =     na * na
  lowerCAmelCase__				:  Union[str, Any]		       =     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)







def      __lowerCAmelCase			(					UpperCamelCase      )     ->	bool:
  if not isinstance(UpperCamelCase	,      UpperCamelCase      ):
    raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''      )
  if len(UpperCamelCase      ) == 0:
    raise ValueError('''Input list must be a non empty list'''      )
  if len(UpperCamelCase      ) == 1:
    return True
  lowerCAmelCase__				:  Tuple		       =     series[1] - series[0]
  for index in range(len(UpperCamelCase      ) - 1      ):
    if series[index + 1] - series[index] != common_diff:
      return False
  return True



def      __lowerCAmelCase			(					UpperCamelCase      )     ->	float:
  if not isinstance(UpperCamelCase	,      UpperCamelCase      ):
    raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''      )
  if len(UpperCamelCase      ) == 0:
    raise ValueError('''Input list must be a non empty list'''      )
  lowerCAmelCase__				:  int		       =     0
  for val in series:
    answer += val
  return answer / len(UpperCamelCase      )


if __name__ == "__main__":
     import doctest

     doctest.testmod()

