#include #include #include #include using namespace std; typedef long long ll; typedef vector vl; typedef vector vvl; const ll mod=1e9+7; const ll M=2005; ll C[M][M],P[M][M]; void Init(){ C[0][0]=P[0][0]=1; for(int i=0;ij) C[i][j]=C[i-1][j]; if(i&&j) (C[i][j]+=C[i-1][j-1])%=mod; if(j) P[i][j]=P[i-1][j-1]*i%mod; else P[i][j]=1; } } int n; class Trie{ private: const int MAX=210000; int ID=1; vvl date; vl a,u,dp; void Fix(vl& dp,ll h,int v){ if(u[v]==1){ dp[1]=1; return; } for(int i=1;i>n; Trie trie; for(int i=0;i>s; s+="{"; trie.Update(s); } trie.Solve(); }