def distill_links(F1, F2):
    """
    Obtains the distilled fidelity of two links assuming Werner states
    :param F1: type float
        Fidelity of link 1
    :param F2: type float
        Fidelity of link 2
    :return: type float
        Fidelity of the distilled link
    """
    a = F1 * F2
    b = (1 - F1) / 3
    c = (1 - F2) / 3
    return (a + b * c) / (a + F1 * c + F2 * b + 5 * b * c)