def paml_model_output(Q, eq):
    """
    Construct and return a string containing the
    R matrix (which is symmetric and q_ij = r_ij*p_j)
    for subsequent use in PAML.
    """
    output_string = ''
    for row in range(1, 20):
        for col in range(0, row):
            r = Q[row, col] / eq[col]
            output_string += f'{r:<8.5} '
        output_string = output_string.rstrip()
        output_string += '\n'
    eq_str = ''
    for elem in range(0, 20):
        eq_str += f'{eq[elem]:<8.5} '
    output_string += '\n' + eq_str.rstrip()
    return output_string
