Sushi Dinner

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

문제

Compute the number of ways to choose two subsets X,Y2,3,,nX, Y \subseteq \\{2, 3, \dots, n\\} such that there does not exist xX,yYx \in X, y \in Y such that xx and yy are not relatively prime. The sets X,YX, Y may be empty. Output the number of ways modulo pp.

입력

The input contains the integer nn and the modulo pp separated by a space.

출력

Output the number of ways to choose the subsets X,Y2,3,,nX, Y \subseteq \\{2, 3, \dots, n\\} satisfying the condition above.

제한

  • 2n5002 \le n \le 500
  • 0<p1,000,000,0000 < p \le 1\\,000\\,000\\,000