시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 512 MB222100.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.

예제 입력 1

2 998244353

예제 출력 1

1

예제 입력 2

3 1001177

예제 출력 2

5

예제 입력 3

4 1000003

예제 출력 3

54

예제 입력 4

5 1000159

예제 출력 4

1108

예제 입력 5

6 1000253

예제 출력 5

41880

예제 입력 6

7 100000007

예제 출력 6

2946440

예제 입력 7

10 100001303

예제 출력 7

82834735

예제 입력 8

25 100002013

예제 출력 8

77432340

예제 입력 9

31 100001887

예제 출력 9

7237626

예제 입력 10

42 100002593

예제 출력 10

44678783

예제 입력 11

68 31235417

예제 출력 11

22825855

예제 입력 12

117 12345847

예제 출력 12

4325099

예제 입력 13

200 1000000007

예제 출력 13

194453485

예제 입력 14

228 12348143

예제 출력 14

6438982

예제 입력 15

300 34569361

예제 출력 15

24221941

예제 입력 16

312 34570903

예제 출력 16

12146306

예제 입력 17

322 41236777

예제 출력 17

26590080

예제 입력 18

350 41237641

예제 출력 18

40908795

예제 입력 19

366 66666667

예제 출력 19

57608403

예제 입력 20

378 99000007

예제 출력 20

61227322

예제 입력 21

399 99990001

예제 출력 21

46973248

예제 입력 22

400 1000000009

예제 출력 22

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.