Triangulation

No attempts yetTime limit1sMemory limit32 MB

Problem

A triangulation of a convex polygon divides its interior into triangles using diagonals that do not cross one another. The vertices are numbered from 11 to NN, and two triangulations are considered different whenever their sets of diagonals differ.

For example, a pentagon can be triangulated in exactly five ways.

Let TnT_n be the number of ways to triangulate a convex nn-gon. Write a program that computes T3+T4++TnT_3 + T_4 + \cdots + T_n.

Input

The first line contains two integers nn and mm, separated by a space. (3n1000003 \le n \le 100\,000, 2m1092 \le m \le 10^9)

Output

Print the remainder of T3+T4++TnT_3 + T_4 + \cdots + T_n divided by mm.