Олимпиадный тренинг

Задача 38499. Skittles coloring


Задача

Темы: Комбинаторика
N pins are placed in a row. Gromozeka paints each of them one of the K colors from her paint cans. For aesthetic reasons, any two adjacent pins should be painted in different colors. Find the number of possible ways to color the skittles.

Input
The input string contains two integers N and K (\(1<=N<=1000\),  \(2<=K<=1000\)).

Imprint
Display the answer to the problem. It is guaranteed that the correct answer does not exceed \(2^{31}-1\).
 

 

Examples
# Input Output
1 2 2 2
1 1 10 10