#include<cstdio>
#define N 100010
#define mo 1000000007
#define ll long long
#define fo(x,a,b) for(int x=(a);x<=(b);x++)
#define fd(x,a,b) for(int x=(a);x>=(b);x--)
using namespace std;
int n;
ll f[N][2],num[N][2],a[N];

inline int read() {
	int x=0,f=0; char c=getchar();
	while (c<'0'||c>'9') f=(c=='-')?1:f,c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return f?-x:x;
}

int main() {
	n=read();
	fo(i,1,n) a[i]=read();
	f[1][0]=a[1],f[1][1]=0;
	num[1][0]=1,num[1][1]=0;
	fo(i,2,n) {
		f[i][0]=(f[i-1][0]+num[i-1][0]*a[i]%mo+f[i-1][1]+num[i-1][1]*a[i]%mo)%mo;
		f[i][1]=(f[i-1][0]-num[i-1][0]*a[i]%mo+mo)%mo;
		num[i][0]=(num[i-1][0]+num[i-1][1])%mo;
		num[i][1]=num[i-1][0];
	}
	printf("%lld\n",((f[n][0]+f[n][1])%mo+mo)%mo);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define Gene template< class
#define Rics printer& operator,
Gene c> struct rge{c b, e;};
Gene c> rge<c> range(c i, c j){ return {i, j};}
struct printer{
    ~printer(){cerr<<endl;}
    Gene c >Rics(c x){ cerr<<boolalpha<<x; return *this;}
    Rics(string x){cerr<<x;return *this;}
    Gene c, class d >Rics(pair<c, d> x){ return *this,"(",x.first,", ",x.second,")";}
    Gene ... d, Gene ...> class c >Rics(c<d...> x){ return *this, range(begin(x), end(x));}
    Gene c >Rics(rge<c> x){
        *this,"["; for(auto it = x.b; it != x.e; ++it)
            *this,(it==x.b?"":", "),*it; return *this,"]";}
};
#define debug() cerr<<"LINE "<<__LINE__<<" >> ", printer()
#define dbg(x) "[",#x,": ",(x),"] "
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int my_rand(int l, int r) {
    return uniform_int_distribution<int>(l, r) (rng);
}

const int N = 105;

int mod;
int dp[N][N*N*N];

int main() {
//    freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, K;
    cin >> n >> K >> mod;

    dp[0][0] = 1;
    int sum = 0;
    for(int i = 1; i <= n; i++) {
        sum += K * i;
        for(int s1 = 0; s1 < i; s1++) {
            int ways = 0;
            for(int s = s1; s <= sum; s += i) {
                ways += dp[i-1][s];
                if(ways >= mod) ways -= mod;
                if(s-(K+1)*i >= 0) {
                    ways -= dp[i-1][s-(K+1)*i];
                    if(ways < 0) ways += mod;
                }
                dp[i][s] = ways;
//                debug(), dbg(i), dbg(s), dbg(dp[i][s]);
            }
        }
    }
    for(int avg = 1; avg <= n; avg++) {
        int ways = 0;
        for(int s = 0; s <= sum; s++) {
            ways += 1ll*dp[avg-1][s]*dp[n-avg][s]%mod;
            if(ways >= mod) ways -= mod;
        }
        ways = 1ll*ways*(K+1)%mod;
        ways--;
        if(ways < 0) ways += mod;
        cout << ways << "\n";
    }
}



