My solution:We use two facts:

if

and

are relatively prime numbers then

Now, it's obiviously

so it's

But,

so we can write

We define

![$$=(1+x+x^2)^r\cdot \left[(1+x+x^2)^{mp}-(1+x^p+x^{2p})^m \right]$$ $$=(1+x+x^2)^r\cdot \left[(1+x+x^2)^{mp}-(1+x^p+x^{2p})^m \right]$$](https://dxdy-02.korotkov.co.uk/f/5/9/3/593cd1cf8f85ce2fee2b9ccfbec20d1982.png)
![$$=(1+x+x^2)^r\cdot \left[(1+x+x^2)^p-(1+x^p+x^{2p})\right]\cdot\left[(1+x+x^2)^{p(n-1)}+\cdots+(1+x^p+x^{2p})^{n-1}\right]$$ $$=(1+x+x^2)^r\cdot \left[(1+x+x^2)^p-(1+x^p+x^{2p})\right]\cdot\left[(1+x+x^2)^{p(n-1)}+\cdots+(1+x^p+x^{2p})^{n-1}\right]$$](https://dxdy-03.korotkov.co.uk/f/6/6/e/66e706e0ee3ad25d1473c58ffc34078282.png)

Now we look at the coefficient with

in the development of the expression:
1)

is coefficient in

2)

By multiplication marked expression give the coefficient with

and it is

