You have roses of different colors. In particular, you have roses of each color. Please compute the number of ways to plant all the roses in a line of pots, one rose per pot, in such a way that there is exactly one pair of adjacent roses of the same color. The roses of the same color are indistinguishable.
Input consists of several cases, each with and . Assume that is either 2 or 3. For , we have . For , we have .
For every case, print the answer modulo .
Author: Salvador Roura
Generation: 2026-01-25T10:13:57.318Z
© Jutge.org, 2006–2026.
https://jutge.org