#P1174E. Ehab and the Expected GCD Problem
Ehab and the Expected GCD Problem
No submission language available for this problem.
Description
Let's define a function on a permutation as follows. Let be the greatest common divisor (GCD) of elements , , ..., (in other words, it is the GCD of the prefix of length ). Then is the number of distinct elements among , , ..., .
Let be the maximum value of among all permutations of integers , , ..., .
Given an integers , count the number of permutations of integers , , ..., , such that is equal to . Since the answer may be large, print the remainder of its division by .
The only line contains the integer () — the length of the permutations.
The only line should contain your answer modulo .
Input
The only line contains the integer () — the length of the permutations.
Output
The only line should contain your answer modulo .
Samples
Note
Consider the second example: these are the permutations of length :
- , .
- , .
- , .
- , .
- , .
- , .
The maximum value , and there are permutations such that .