def to_line_equation(coefs, p):
    """
    Substitutes point p into line equation determined by coefs
    :param coefs: list or tuple of 3 elements (or anything that can be unzipped to 3 elements)
    :param p: point
    :return: A * p.real + B * p.imag + C
    """
    A, B, C = coefs
    return A * p.real + B * p.imag + C