Permutation and Combination

I want to distribute n balls into r person but in n balls there are a1 ,a2,a3…ak are alikes.
a1+a2+…+ak=n
Question is asking in how many ways we can distribute it into r boxes.

Please Help…
Thanks in advance

You can read about it here: Stars and bars - Algorithms for Competitive Programming
Here is an useful video: https://youtu.be/8CryoVUNs_o

Thanks alot