def get_distance_term(C, mag, rrup):
    """
    Returns the distance attenuation factor
    """
    rval = np.sqrt(rrup ** 2. + CONSTANTS["h"] ** 2.)
    rref_val = np.sqrt(CONSTANTS["Rref"] ** 2. +
                       CONSTANTS["h"] ** 2.)

    f_r = (C["c1"] + C["c2"] * (mag - CONSTANTS["Mref"])) *\
        np.log(rval / rref_val) + (C["c3"] * (rval - rref_val) / 100.)
    return f_r