Bangle

Splendid bangles inlaid with gorgeous diamonds are the special products of jewelry factories. With the industrialization of jewelry manufacture, common bangles become cheaper than ever. But the dream of ownning characteristic bangle becomes costlier than ever. For this reason, a jewelry factory designed a new kind of bangle inlaid with various diamonds according to customers’ demand, which realized the dream of ownning characteristic bangle. But one day the manager of a jwewlry factory asked himself, “How many kinds of bangles I could produce with the same style?” That is, if the bangle has m places to be inlaid with diamonds and he has n kinds of diamonds to inlay, how may different kinds of bangles he could produce? As you know, bangle is a circular jewelry. The places to be inlaid with diamonds are spaced equally round the circle. And also, the bangle could be rotated and turned over. We assume that there are two bangles. And we rotate and turn over a bangle for some times, then the bangle becomes the same as another one. We should regard the two bangles as the same kind. Input The input file may contains serval data sets. Each data set consists of two integers m (2 < m ≤ 27−n+19) and n (1 < n ≤ 7). The first integer m represents the number of places to be inlaid with diamonds in the bangle. The second integer n represents the number of the kinds of the diamonds. The input file is terminated by m = 0 and n = 0. Output For each data set, compute s (s < 1017), the number of the different kinds of the bangles could be produced. Output your answer as a single integer on a line by itself. Sample Input 43 20 7 00 Sample Output 21 1994807229453766