// Created by calabash_boy
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#ifdef __LOCAL_DEBUG__
# define _debug(fmt, ...) fprintf(stderr, "\033[91m[%s %3d]: " fmt "\n\033[0m", \
  __func__,__LINE__, ##__VA_ARGS__)
#else
# define _debug(...) (void(0))
#endif
#define PB(x) push_back(x)
#define rep(i,l,r) for (int i = l,_ = r;i< _;i++)
#define REP(i,l,r) for (int i=l,_=r;i<=_;i++)
#define leave(x) do {cout<<#x<<endl;fflush(stdout);return 0;}while (0);
#define untie do{ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}while (0)
#define range(x) x.begin(),x.end()
typedef long long LL;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 0x3f3f3f3f;
const ll inf_ll = 0x3f3f3f3f3f3f3f3fLL;
mt19937 wdy(time(0));
/************* header ******************/
const int maxn = 405;
int mod;
inline void Add(int &tar, int del){
    (tar += del) %= mod;
}
int C[maxn][maxn];
int pow2[maxn];

int n;

void init(){
    pow2[0] = 1;
    for (int i = 1; i < maxn; i ++){
        pow2[i] = pow2[i-1] * 2 % mod;
    }
    C[0][0] = 1;
    for (int i = 1; i < maxn; i ++){
        C[i][0] = C[i][i] = 1;
        for (int j = 1; j < i; j ++){
            C[i][j] = (C[i-1][j] + C[i-1][j-1]) % mod;
        }
    }
}

// dp[n][k]
// turn on n lights,
// the n-th is manually turned on.
// k of n are automatically turned on.
int dp[maxn][maxn];
void dpwork(){
    for (int i = 1; i <= n; i ++){
        dp[i][0] = pow2[i-1];
        for (int j = 1; j < i; j ++){
            // ii-th is the last automatically turned on one.
            for (int ii = 2; ii < i; ii ++){
                Add(dp[i][j], 1ll * dp[ii-1][j-1] * pow2[i - ii - 1] % mod * C[i-j][i - ii] % mod);
            }
        }
    }
}

int main(){
    cin>>n>>mod;
    init();
    dpwork();
    int ans = 0;
    for (int i = 0; i <= n; i ++){
        Add(ans, dp[n][i]);
    }
    cout<<ans<<endl;
    return 0;
}
### Prompt

Create a solution in cpp for 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
// Created by calabash_boy
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#ifdef __LOCAL_DEBUG__
# define _debug(fmt, ...) fprintf(stderr, "\033[91m[%s %3d]: " fmt "\n\033[0m", \
  __func__,__LINE__, ##__VA_ARGS__)
#else
# define _debug(...) (void(0))
#endif
#define PB(x) push_back(x)
#define rep(i,l,r) for (int i = l,_ = r;i< _;i++)
#define REP(i,l,r) for (int i=l,_=r;i<=_;i++)
#define leave(x) do {cout<<#x<<endl;fflush(stdout);return 0;}while (0);
#define untie do{ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}while (0)
#define range(x) x.begin(),x.end()
typedef long long LL;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 0x3f3f3f3f;
const ll inf_ll = 0x3f3f3f3f3f3f3f3fLL;
mt19937 wdy(time(0));
/************* header ******************/
const int maxn = 405;
int mod;
inline void Add(int &tar, int del){
    (tar += del) %= mod;
}
int C[maxn][maxn];
int pow2[maxn];

int n;

void init(){
    pow2[0] = 1;
    for (int i = 1; i < maxn; i ++){
        pow2[i] = pow2[i-1] * 2 % mod;
    }
    C[0][0] = 1;
    for (int i = 1; i < maxn; i ++){
        C[i][0] = C[i][i] = 1;
        for (int j = 1; j < i; j ++){
            C[i][j] = (C[i-1][j] + C[i-1][j-1]) % mod;
        }
    }
}

// dp[n][k]
// turn on n lights,
// the n-th is manually turned on.
// k of n are automatically turned on.
int dp[maxn][maxn];
void dpwork(){
    for (int i = 1; i <= n; i ++){
        dp[i][0] = pow2[i-1];
        for (int j = 1; j < i; j ++){
            // ii-th is the last automatically turned on one.
            for (int ii = 2; ii < i; ii ++){
                Add(dp[i][j], 1ll * dp[ii-1][j-1] * pow2[i - ii - 1] % mod * C[i-j][i - ii] % mod);
            }
        }
    }
}

int main(){
    cin>>n>>mod;
    init();
    dpwork();
    int ans = 0;
    for (int i = 0; i <= n; i ++){
        Add(ans, dp[n][i]);
    }
    cout<<ans<<endl;
    return 0;
}
```