def solve_modular_equation(a, b, c):
    """
    Find solution of ax % b = c (a and b relative primes, ie assume gcd(a, b) == 1)
    pow(a, -1, mod=b) computes the modular multiplicative inverse for python >= 3.8
    """
    return (pow(a, -1, mod=b) * c) % b