from functools import reduce


def horners_evaluation(f, u):
    """
    Fast evaluation of f(u).
    """

    if f.is_zero():
        return f.parent().base().zero()

    coefs = reversed(f.coefficients(sparse=False))
    return reduce(lambda acc, next: acc * u + next, coefs)