#if defined(_USE_PCH_)
#include "pch.hpp"
#else
#include <bits/stdc++.h>
#endif
#define RNG(V_, A_, B_, ...) for(int V_=(A_), V_##_END=(B_) __VA_OPT__(,) __VA_ARGS__; V_<=V_##_END; V_++)
#define IRNG(V_, A_, B_, ...) for(int V_=(A_), V_##_END=(B_) __VA_OPT__(,) __VA_ARGS__; V_>=V_##_END; V_--)
#ifdef _WIN32
#define long int64_t
#endif
#define _UN using namespace
using namespace std;
const int MAXN=2010;
int n,qn; long mod;
long F[MAXN][MAXN],ans;
int main(){
#if defined(_LOCAL_)
    freopen("in","r",stdin);
    freopen("out","w",stdout);
//  freopen("/dev/null","w",stderr);
#else
    freopen("distant.in","r",stdin);
    freopen("distant.out","w",stdout);
#endif
    ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
    cin>>n>>qn>>mod;
    F[0][0]=1;
    RNG(j,1,n-1){
        long s=0;
        RNG(i,0,j-1) s=(s+F[i][j-1])%mod;
        RNG(i,j,n){
            F[i][j]=(s*2-F[i-1][j-1]+mod)%mod;
            s=(s+F[i][j-1])%mod;
        }
    }
    
}