Let it Bead#7079

Let it Bead

1 second
64 megabytes
Medium

"Let it Bead" company is located upstairs at Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department found out that customers are interested in buying colored bracelets. However, over percent of the target audience insists that the bracelets be unique. (Just imagine what would happen if two women showed up at the same party wearing identical bracelets!) It's a good thing that bracelets can have different lengths and need not be made of beads of one color. Help the boss estimate maximum profit by calculating how many different bracelets can be produced.

A bracelet is a ring-like sequence of beads, each of which can have one of distinct colors. The ring is closed, i.e., it has no beginning or end, and has no direction. Assume an unlimited supply of beads of each color. For different values of and , calculate the number of different bracelets that can be made.

Input

Every line of the input file defines a test case and contains two integers: the number of available colors , followed by the length of the bracelets . Input is terminated by k = n = 0. Otherwise, both are positive, and, due to technical difficulties in the bracelet-fabrication machine, k \cdot n \le 32, i.e., their product does not exceed .

Output

For each test case, output on a single line the number of unique bracelets.

The figure below shows the different bracelets that can be made with colors and beads.

Examples

Example 1

Loading
Loading