P and Q started a partnership business investing some amount in the ratio of 3:5. R joined them after six months with an amount equal to that of Q. What should be the proportion in which the profit at the end of the year is distributed among P, Q, and R?