def multiply_by_u(x, u=(9, 4), d=5):
    """
    Multiply x with u, interpreting as numbers from the field sqrt(d). Where u is a fundamental solution.
    Args:
        x: <tuple> (a,b) to be interpreted as (a+b*sqrt(d))
        u: <tuple> (u1,u2) to be interpreted as (u1+u2*sqrt(d))
        d: <int>

    Returns: (x,y) such that (x + y*sqrt(5)) = x * u
    """
    a, b = x
    u1, u2 = u

    f = u1 * a + u2 * d * b
    s = u2 * a + u1 * b
    return f, s