#include <bits/stdc++.h>

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
    if (a > b) a = b;
}

template<class T, class U>
void ckmax(T &a, U b)
{
    if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

const int MAXN = 413;

int TC;
int N, INF;

int add(int a, int b)
{
    a += b; if (a >= INF) a -= INF; return a;
}
int mul(int a, int b)
{
    return (ll) a * b % INF;
}
int sub(int a, int b)
{
    a -= b; if (a < 0) a += INF; return a;
}
int pwr(int a, int b)
{
    int res = 1;
    while(b > 0)
    {
        if (b & 1) res = mul(res, a);
        b >>= 1;
        a = mul(a, a);
    }
    return res;
}
int inv(int a)
{
    return pwr(a, INF - 2);
}
int dvd(int a, int b)
{
    return mul(a, inv(b));
}

int dp[MAXN][MAXN];
int ans;

int32_t main()
{
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(4);
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> N >> INF;
    dp[1][1] = 1; //dp[i][j] = the min size is i, and you have j components.
    FOR(i, 1, N + 1)
    {
        FOR(j, 1, N + 1)
        {
            //here, we only play w/ 0 connected component.
            //make a new component, and connect it to neither.
            dp[i + 1][j + 1] = add(dp[i + 1][j + 1], mul(j + 1, dp[i][j]));

            //here, we only play w/ 1 connected component.
            //add a # to the elft of a component.
            dp[i + 1][j] = add(dp[i + 1][j], mul(j, dp[i][j]));
            //add a # to the right of a component.
            dp[i + 1][j] = add(dp[i + 1][j], mul(j, dp[i][j]));
            //add a # two to the left of a component.
            dp[i + 2][j] = add(dp[i + 2][j], mul(j, dp[i][j]));
            //add a new # two to the right of a component.
            dp[i + 2][j] = add(dp[i + 2][j], mul(j, dp[i][j]));
            //make a new component, and connect it to both.

            //here, we merge 2 connected components.
            //1,1 is not allowed!
            //1,2
            dp[i + 2][j - 1] = add(dp[i + 2][j - 1], mul(j - 1, dp[i][j]));
            //2,1
            dp[i + 2][j - 1] = add(dp[i + 2][j - 1], mul(j - 1, dp[i][j]));
            //2,2
            dp[i + 3][j - 1] = add(dp[i + 3][j - 1], mul(j - 1, dp[i][j]));
        }
    }
    ans = dp[N][1];
    cout << ans << '\n';
}

### Prompt

Please formulate a Cpp solution to the following problem:

There are n computers in a row, all originally off, and Phoenix wants to turn all of them on. He will manually turn on computers one at a time. At any point, if computer i-1 and computer i+1 are both on, computer i (2 ≤ i ≤ n-1) will turn on automatically if it is not already on. Note that Phoenix cannot manually turn on a computer that already turned on automatically.

If we only consider the sequence of computers that Phoenix turns on manually, how many ways can he turn on all the computers? Two sequences are distinct if either the set of computers turned on manually is distinct, or the order of computers turned on manually is distinct. Since this number may be large, please print it modulo M.

Input

The first line contains two integers n and M (3 ≤ n ≤ 400; 10^8 ≤ M ≤ 10^9) — the number of computers and the modulo. It is guaranteed that M is prime.

Output

Print one integer — the number of ways to turn on the computers modulo M.

Examples

Input


3 100000007


Output


6


Input


4 100000007


Output


20


Input


400 234567899


Output


20914007

Note

In the first example, these are the 6 orders in which Phoenix can turn on all computers: 

  * [1,3]. Turn on computer 1, then 3. Note that computer 2 turns on automatically after computer 3 is turned on manually, but we only consider the sequence of computers that are turned on manually. 
  * [3,1]. Turn on computer 3, then 1. 
  * [1,2,3]. Turn on computer 1, 2, then 3. 
  * [2,1,3] 
  * [2,3,1] 
  * [3,2,1] 

### Response

```cpp
#include <bits/stdc++.h>

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
    if (a > b) a = b;
}

template<class T, class U>
void ckmax(T &a, U b)
{
    if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

const int MAXN = 413;

int TC;
int N, INF;

int add(int a, int b)
{
    a += b; if (a >= INF) a -= INF; return a;
}
int mul(int a, int b)
{
    return (ll) a * b % INF;
}
int sub(int a, int b)
{
    a -= b; if (a < 0) a += INF; return a;
}
int pwr(int a, int b)
{
    int res = 1;
    while(b > 0)
    {
        if (b & 1) res = mul(res, a);
        b >>= 1;
        a = mul(a, a);
    }
    return res;
}
int inv(int a)
{
    return pwr(a, INF - 2);
}
int dvd(int a, int b)
{
    return mul(a, inv(b));
}

int dp[MAXN][MAXN];
int ans;

int32_t main()
{
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(4);
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> N >> INF;
    dp[1][1] = 1; //dp[i][j] = the min size is i, and you have j components.
    FOR(i, 1, N + 1)
    {
        FOR(j, 1, N + 1)
        {
            //here, we only play w/ 0 connected component.
            //make a new component, and connect it to neither.
            dp[i + 1][j + 1] = add(dp[i + 1][j + 1], mul(j + 1, dp[i][j]));

            //here, we only play w/ 1 connected component.
            //add a # to the elft of a component.
            dp[i + 1][j] = add(dp[i + 1][j], mul(j, dp[i][j]));
            //add a # to the right of a component.
            dp[i + 1][j] = add(dp[i + 1][j], mul(j, dp[i][j]));
            //add a # two to the left of a component.
            dp[i + 2][j] = add(dp[i + 2][j], mul(j, dp[i][j]));
            //add a new # two to the right of a component.
            dp[i + 2][j] = add(dp[i + 2][j], mul(j, dp[i][j]));
            //make a new component, and connect it to both.

            //here, we merge 2 connected components.
            //1,1 is not allowed!
            //1,2
            dp[i + 2][j - 1] = add(dp[i + 2][j - 1], mul(j - 1, dp[i][j]));
            //2,1
            dp[i + 2][j - 1] = add(dp[i + 2][j - 1], mul(j - 1, dp[i][j]));
            //2,2
            dp[i + 3][j - 1] = add(dp[i + 3][j - 1], mul(j - 1, dp[i][j]));
        }
    }
    ans = dp[N][1];
    cout << ans << '\n';
}

```