Degrees of permutations#1140

Degrees of permutations

4 seconds
64 megabytes
Easy

Let be a natural number, and let S = \{ 1, 2, 3, \ldots, N \}. A function f : S \to S is called beautiful if there exists a bijective function g : S \to S such that for every in , the equation g(g(g(\ldots g(x) \ldots ))) = f(x) holds, where is applied exactly times.

You need to find the number of beautiful functions. Since the answer can be very large, print the result modulo .

Input

The input consists of a single line containing the natural numbers and (N \leq 2000, d \leq 10^{18}).

Output

Output the number of beautiful functions for the given and , modulo .

Examples

Example 1

Loading
Loading