Exercise (Gold)#10312

Exercise (Gold)

1 second
128 megabytes
Very hard

Farmer John has come up with a new morning exercise routine for the cows (again)!

As before, Farmer John's cows are standing in a line. The -th cow from the left has label for each (1 \leq i \leq n). He tells them to repeat the following step until the cows are in the same order as when they started.

Given a permutation A of length , the cows change their order such that the -th cow from the left before the change is A_i-th from the left after the change.

For example, if A = (1, 2, 3, 4, 5) then the cows perform one step. If A = (2, 3, 1, 5, 4), then the cows perform six steps. The order of the cows from left to right after each step is as follows:

steps: (1, 2, 3, 4, 5)

step: (3, 1, 2, 5, 4)

steps: (2, 3, 1, 4, 5)

steps: (1, 2, 3, 5, 4)

steps: (3, 1, 2, 4, 5)

steps: (2, 3, 1, 5, 4)

steps: (1, 2, 3, 4, 5)

Find the sum of all positive integers such that there exists a permutation of length that requires the cows to take exactly steps.

As this number may be very large, output the answer modulo .

Input

One line contains (1 \leq n \leq 10^4) and (10^8 \leq m \leq 10^9 + 7, is prime).

Output

A single integer.

Examples

There exist permutations that cause the cows to take , , , , and steps. Thus, the answer is 1 + 2 + 3 + 4 + 5 + 6 = 21.

Example 1

Loading
Loading