def nonneg_lb(n, S, k, eta=None, tol=1e-04):
    """
    Lower bound required for non-negativity of v(S).
    :param n: size of reference dataset Y
    :param S: minimum party dataset size
    :param k: value of diagonal terms (usually 1)
    :param eta: upper bound (if none, set to k)
    :return: scalar
    """
    if eta is None:
        eta = k

    return (n - 2 * S) / (2 * S * (n - S)) * (k + (S - 1) * eta) - tol