def METHOD_NAME(ctx, terms, check_step=1):
    s = ctx.zero
    k = 0
    for term in terms():
        s += term
        if (not k % check_step) and term:
            if abs(term) <= 1e-18*abs(s):
                break
        k += 1
    return s