Parentheses

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

문제

A correct parentheses sequence can be defined recursively as follows:

  • The empty string is a correct sequence.
  • If XX and YY are correct sequences, then XYX Y (the concatenation of XX and YY) is a correct sequence.
  • If XX is a correct sequence, then (X)`(`X`)` is a correct sequence.

Each correct parentheses sequence can be derived using the above rules.

For a parentheses sequence, you can make some operations with it.

  • Each time you can choose two indices LL and RR such that LRL \le R. The operation modifies the characters on indices from LL to RR, inclusive.
  • First, the order of these characters is reversed.
  • Then, each character is toggled to the opposite one. That is, each '(' in the specified range changes to a ')' and vice versa.

The value of a parentheses sequence is the minimal number of the operations required to change it into a correct parentheses sequence. If it is impossible, the value of the sequence is equal to 1010010^{100}.

For example, the value of "()((" is 11, the value of "()()" is 00, and the value of "(((" is 1010010^{100}.

You are given an integer nn. For each 1in1 \le i \le n, find the number A_iA\_i of different parentheses sequence of length nn which has value ii, and then calculate the sum _i=0n((i+1)A_i)\sum\_{i = 0}^{n} ((i + 1) \cdot A\_i).

The answer may be very large, so print it modulo the given integer mm.

입력

The first line of the input contains two integers nn and mm (1n1061 \le n \le 10^6, 1m1091 \le m \le 10^9).

출력

Print one integer: the answer to the problem.