Balls in a bag problem

Question

Hints

Answer