문제
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 . He tells them to repeat the following step until the cows are in the same order as when they started.
Given a permutation of length , the cows change their order such that the -th cow from the left before the change is -th from the left after the change.
For example, if then the cows perform one step. If , then the cows perform six steps. The order of the cows from left to right after each step is as follows:
0 steps: 1 step: 2 steps: 3 steps: 4 steps: 5 steps: 6 steps:
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 (, is prime).
입력
The first line contains and .
출력
A single integer.
예제 입력 1
5 1000000007
예제 출력 1
21
점수
Test cases 2-5 satisfy .Test cases 6-10 satisfy no additional constraints.
코드를 제출하려면 로그인이 필요합니다.
로그인