Firstly, we will consider the four persons named in the problem.Let’s start finding the ways-
(the colors are written with the first letter)
Rafin. Rahul. Jaber. Jubair. TOTAL WAYS
g. g. g. b. → 9!/(6!2!)
g. g. b. g. → "
g. g. g. r. → 9!/5!3!
g. g. r. g. → "
g. g. b. r. → 9!/2!5!2!
g. g. r. b. → "
In this pattern we have calculated giving green pens to the first two persons,alike we have to count the ways giving them red and blue colored pens.
The TOTAL WAYS in the corner means in how many ways we can divide the pens into the 13 persons. After calculating the ways individually, we will then determine the sum and that’ll be our final answer.
Hope this’ll be helpful.(Though I haven’t described how I count the ways)