// C++(GCC 9.2.1)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const LL MOD = 1e9 + 7;
LL a[101010], f[101010], dp[101010][2];

int main(){
    
    // 1. 入力情報.
    int N;
    scanf("%d", &N);
    rep(i, N) scanf("%lld", &a[i]);
    
    // 2. フィボナッチ数列.
    f[0] = 1;
    f[1] = 1;
    rep(i, N) f[i + 2] = f[i + 1] + f[i], f[i + 2] %= MOD;
    
    // 3. dp更新.
    dp[0][0] = a[0];
    repx(i, 1, N){
        dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) + a[i] * f[i];
        dp[i][1] = dp[i - 1][0] + MOD * f[i - 1] - a[i] * f[i - 1];
        dp[i][0] %= MOD;
        dp[i][1] %= MOD;
    }
    
    // 4. 出力.
    printf("%lld\n", (dp[N - 1][0] + dp[N - 1][1]) % MOD);
    return 0;
    
}
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")



#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << x << endl;
#else
    #define dbg(x)
#endif

#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a, b) for (int i = a; i < b; i++)
#define fj(a, b) for (int j = a; j < b; j++)
#define fk(a, b) for (int k = a; k < b; k++)
#define fi1(a, b) for (int i = a - 1; i >= b; i--)
#define fj1(a, b) for (int j = a - 1; j >= b; j--)
#define fk1(a, b) for (int k = a - 1; k >= b; k--)
#define fx(x, a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



int MOD;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 101;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll add(ll a, ll b) {
    a += b;
    if (a >= MOD) return a - MOD;
    return a;
}

ll sub(ll a, ll b) {
    a -= b;
    if (a < 0) return a + MOD;
    return a;
}

ll mult(ll a, ll b) {
    return a * b % MOD;
}

ll powmod(ll a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mult(a, powmod(a, p - 1));
    return powmod(mult(a, a), p / 2);
}

ll rev(ll a) {
    return powmod(a, MOD - 2);
}


int dp[MX][MX * MX * MX];
int mxs[MX];

int n, k;

void init() {
    mxs[0] = 0;
    dp[0][0] = 1;
    int kek = 0;
    for (int i = 1; i < n; ++i) {
        if (2 * i <= n - 1) {
            mxs[i] = mxs[i - 1] + i * k;
        } else {
            mxs[i] = mxs[n - 1 - i];
        }
        for (int s = 0; s <= mxs[i]; ++s) {
            for (int d = 0; d * i <= s && d <= k; ++d) {
                ++kek;
                dp[i][s] = add(dp[i][s], dp[i - 1][s - d * i]);
            }
        }
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    cin >> n >> k >> MOD;
    init();
    for (int x = 1; x <= n; ++x) {
        int ans = 0;
        for (int s = 0; s <= mxs[x - 1]; ++s) {
            ans = add(ans, mult(dp[x - 1][s], dp[n - x][s]));
        }
        cout << sub(mult(ans, k + 1), 1) << '\n';
    }
}
