A triangulation of a convex polygon divides its interior into triangles using diagonals that do not cross one another. The vertices are numbered from 1 to N, and two triangulations are considered different whenever their sets of diagonals differ.
For example, a pentagon can be triangulated in exactly five ways.
Let Tn be the number of ways to triangulate a convex n-gon. Write a program that computes T3+T4+⋯+Tn.
The first line contains two integers n and m, separated by a space. (3≤n≤100000, 2≤m≤109)
Print the remainder of T3+T4+⋯+Tn divided by m.