Expected length of the minimum cycle

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

You are given a positive integer NN, find the expected length of the minimum cycle in permutation of integers from 11 to NN. All permutations are equiprobable.

Consider the answer is an irreducible fraction AB\frac{A}{B}. Output AB1modPA \cdot B^{-1} \mod P, where PP is a given prime number. It is guaranteed that gcd(B,P)=1gcd(B, P) = 1.

입력

The only line of input contains two integers NN and PP (1N1041 \le N \le 10^4, 104<P109+3310^4 < P \le 10^9 + 33). It's guaranteed that PP is a prime number.

출력

Output the answer to the problem in a single line.