#include<bits/stdc++.h>
#include<vector>
#include<math.h>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<set>
#include<string>
#include<string.h>
#include<map>

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization("unroll-loops")

#define ll long long
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"
using namespace std;

const int MOD = 1000000007;
const int Nmax=100005;

ll gcd(ll a,ll b)
{
    if(a==0){
        return b;
    }

    return gcd(b%a,a);
}

int lcm(int a,int b)
{
    return (a*b)/gcd(a,b);
}

bool isPrime(ll n){
	for(int i = 2; i <=sqrt(n); i++)
		if(n % i == 0)
			return 0;
	return 1;
}

void binaryRepresentation(int x)
{
    for (int i = 31; i >= 0; i--)
    {
        if (x&(1<<i)) cout << "1";
        else cout << "0";
    }
}

int combination(int n,int r){
    if(r==n || r==0){
        return 1;
    }

    return combination(n-1,r-1) + combination(n-1,r);
}

bool isPowerOfTwo(ll n)
{
   if(n==0)
        return false;

   return (ceil(log2(n)) == floor(log2(n)));
}

ll power(ll a,ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a);
		b/=2;
		a=(a*a);
	}
	return ans;
}

bool cmp(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
    if(a.first==b.first)
        return a.second<b.second;
    return a.first<b.first;
}

int main()
{
    //vector<vector<int> >ar(n,vector<int> (m,0));
    //vector<int>::iterator ptr;

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    ll n;
    cin>>n;
    vector<ll>ar(n);

    for(ll i=0;i<n;i++)
    {
        cin>>ar[i];
    }
    sort(ar.begin(),ar.end());

    ll ans=0;

    for(ll i=0;i<n;i++)
        ans+=ar[i]*ar[i];
    ans*=(n-1);

    ll sum=0;
    for(ll i=n-1;i>=0;i--)
    {
        ans-=2*(ar[i]*sum);
        sum+=ar[i];
    }
    cout<<ans;

    return 0;
}

#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<bitset>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();++itr)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
#define incm(x,y) {x=((x)+(y))%mod;}
#define spln(i,n) (i==n?'\n':' ')
#define fac_init(n){fac[0]=fac[1]=inv[1]=fi[0]=fi[1]=1;fz(i,2,n){fac[i]=1ll*fac[i-1]*i%mod;inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;fi[i]=1ll*fi[i-1]*inv[i]%mod;}}
using namespace std;
inline void read(int &x)
{
	char c;int f=1;
	while(!isdigit(c=getchar()))if(c=='-')f=-1;
	x=(c&15);while(isdigit(c=getchar()))x=(x<<1)+(x<<3)+(c&15);
	x*=f;
}
int n,m,mod,i,j,k,l,f[2100005],g[2100005],ans[105];
int main()
{
	read(n);read(m);read(mod);
	int cc=2*n*n*m;
	f[cc/2]=m+1;
	fz1(i,n-1){
		fz0k(j,i){
			int s=0;
			for(k=cc/2/i*i+j;k<=cc;k+=i){
				inc(s,f[k])
				g[k]=s;
				if(k>=i*m) dec(s,f[k-i*m]) 
			}
		}
		fz(k,cc/2,cc) f[k]=g[k];
	}
	fz1(i,(n+1)/2){
		printf("%d\n",ans[i]=ans[n-i+1]=(f[cc/2]-1+mod)%mod);
		if(i==n){
			i++;break;
		}
		int x=n-i;
		fz0k(j,x){
			int s=0;
			for(k=j;k<=cc;k+=x){
				g[k]=(f[k]-s+mod)%mod;
				inc(s,g[k])
				if(k>=x*m) dec(s,g[k-x*m])
			}
		}
		fz0g(k,cc) f[k]=g[k];
		fz0k(j,i){
			int s=0;
			for(k=cc/i*i+j;k>=0;k-=i)if(k<=cc){
				inc(s,f[k])
				g[k]=s;
				if(k+i*m<=cc) dec(s,f[k+i*m])
			}
		}
		fz0g(k,cc) f[k]=g[k];
	}
	while(i<=n){
		printf("%d\n",ans[i++]);
	}
	return 0;
}