시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 (추가 시간 없음) | 512 MB | 2 | 2 | 2 | 100.000% |
You are given an integer $n$ and a prime modulo $m$.
Calculate the sum of distances between the first and the second vertices over all distinct labeled connected graphs with $n$ vertices.
Output any integer congruent to the actual sum modulo $m$. Formally, if the actual sum is $S$ output any integer $x$ such that $-2^{63} \leq x < 2^{63}$ and $x - S$ is divisible by $m$.
The only line contains two integers $n$ and $m$ ($2 \leq n \leq 400, 10^6 + 3 \leq m \leq 10^9+9$, $m$ is prime), the number of vertices in the graphs and the modulo.
Print a single integer --- the answer to the problem.
2 998244353
1
3 1001177
5
4 1000003
54
5 1000159
1108
6 1000253
41880
7 100000007
2946440
10 100001303
82834735
25 100002013
77432340
31 100001887
7237626
42 100002593
44678783
68 31235417
22825855
117 12345847
4325099
200 1000000007
194453485
228 12348143
6438982
300 34569361
24221941
312 34570903
12146306
322 41236777
26590080
350 41237641
40908795
366 66666667
57608403
378 99000007
61227322
399 99990001
46973248
400 1000000009
478599227
If you manage to get WA in this problem and we reasonably believe that you did not intentionally try to do so, we might give you a cookie somehow.