import math


def combined_rank(R_k):
    """Compute the combined habitats ranks as described in equation (3)

        Inputs:
            - R_k: the list of ranks

        Output:
            - R_hab as decribed in the user guide's equation 3."""
    R = 4.8 -0.5 *math.sqrt( (1.5 *max(5-R_k))**2 + \
                    sum((5-R_k)**2) -(max(5-R_k))**2)
    if R <=0:
        print('rank', R, 'R_k', R_k)
    return R