(a: int, m: int)
return s % m
Returns x such that a * x = 1 (mod m)
    a and m must be coprime
Returns x such that a * x = 1 (mod m)
    a and m must be coprime
Returns x such that a * x = 1 ( mod m ) a and m must be coprime
def modular_inverse(a: int, m: int) -> int:
    """
    Returns x such that a * x = 1 (mod m)
    a and m must be coprime 
    """

    s, t, g = extended_gcd(a, m)
    if g != 1:
        raise ValueError("a and m must be coprime")
    return s % m
def modular_inverse ( a : int , m : int ) -> int : s , t , g = extended_gcd ( a , m ) if g != 1 : raise ValueError ( "a and m must be coprime" ) return s % m