// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

#include <iostream>
#include <limits.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
#include <memory>
using namespace std;
// #include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

// typedef tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define emb emplace_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ld long double

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <typename T> inline T range(T l, T r) {
    return uniform_int_distribution<T>(l, r)(rng);
}

template <typename T> void Min(T &a, T b) {
    a = min(a, b);
}

template <typename T> void Max(T &a, T b) {
    a = max(a, b);
}

const ll INF = 2e18;
const int inf = 0x3f3f3f3f;
const int N = 1e2 + 5;
int n, m, k;

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

int p[N];

inline int add(int a, int b) {
    a += b;
    if(a >= m)
        return a - m;
    if(a < 0)
        return a + m;
    return a;
}

inline void add_t(int &a, int b) {
    a = add(a, b);
}

inline int mul(int a, int b) {
    return 1LL * a * b % m;
}

main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // freopen("input.txt", "r", stdin);
    cin >> n >> k >> m;
    dp[0][0] = 1;
    for(int i = 1; i <= n; ++i) {
        memset(p, 0, sizeof(p));
        for(int j = 0; j <= n * n * k; ++j) {
            add_t(p[j % i], dp[i-1][j]);
            dp[i][j] = p[j % i];
            if(j >= i * k)
                add_t(p[j % i], -dp[i-1][j - i * k]);
        }
    }
    for(int x = 1; x <= n; ++x) {
        int res = 0;
        for(int i = 1; i <= n * n * k; ++i)
            add_t(res, mul(1LL * dp[x-1][i] * dp[n-x][i] % m, k + 1));
        cout << add(res, k) << endl;
    }
    return 0;
}
#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int cys=998244353;
int n;
int a[105],d[105][10005],fac[105];

int mod(int x){return x>=cys?x-cys:x;}
void add(int &x,int y){x=mod(x+y);}

int main(){
	n=readint();
	for(int i=1;i<=n;i++) a[i]=readint();
	d[0][0]=1;
	int sum=0;
	for(int i=1;i<=n;i++){
		for(int j=i-1;j>=0;j--)
			for(int k=sum;k>=0;k--)
				add(d[j+1][k+a[i]],d[j][k]);
		sum+=a[i];
	}
	if(sum&1) return printf("0\n"),0;
	fac[0]=1;
	for(int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%cys;
	ll ans=0;
	for(int i=1;i<=n;i++) ans=(ans+1ll*fac[i]*fac[n-i]%cys*d[i][sum/2])%cys;
	printf("%lld\n",ans);
	return 0;
}