#include #define FOR(a,b,c) for(int a=b; a=n||s==1) return 1; FOR(i,1,ss+1) { long int oo= fun(a+i,i) * perm(s,i); o = (o+oo%mod)%mod; } return dp[a][s]=o; } void init() { FOR(i,0,n) seq[i]=findseq(i); } int main() { cin >>n; FOR(i,0,n) { cin >> inp[i]; } init(); long o = 0; FOR(i,1,seq[0]+1) { o = (o+fun(i,i))%mod; } cout <