#P3741. 「COCI 2015.3」JANJE

「COCI 2015.3」JANJE

Description

Young Bojan, today a successful student of electrical engineering, loved coloring ever since he was a little boy. Remembering careless days from his childhood, he decided to buy a coloring book and KK colors and get to work. It’s interesting that Bojan doesn’t like colorful pictures, so he decided to color each picture using at most three different colors. Additionally, Bojan will never color two adjacent areas using the same color because, as he puts it, "what’s the use of this line in between then?" Two areas are considered adjacent if their edges have at least one joint point. For example, areas denoted with 44 and 33 (see image below) are adjacent, whereas areas 11 and 22 aren’t. Additionally, coloring of the image below is in accordance with all of Bojan’s demands.

Before he begins coloring a picture, Bojan asks himself in how many ways he can color that picture so he meets with all his conditions. Given the fact that Bojan is studying electrical engineering, it is understandable that combinatorics isn’t his strong point, so he asked you for help.

Input

The first and only line of input contains two integers NN (1N81 \leq N \leq 8) and KK (1K1001 \leq K \leq 100) which denote the ordinal number of the picture from the coloring book and the number of different colors Bojan can use, respectively.

You can find the coloring book called Happy coloring book.pdf in attachments.

Output

The first and only line of output must contain the number of ways Bojan can color the NN-th picture from the coloring book if he has KK different colors at his disposal. Two colorings are different if they differ in color in at least one area.

2 2
0
5 3
12
7 3
96