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

int n,k,mod,dp[110][1000010],sum[110];

int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	cin>>n>>k>>mod;
	dp[0][0]=1;
	for(int i=1;i<=n;i++) {
		memset(sum,0,4*i);
		for(int j=0,lim=n*n*k;j<=lim;j++) {
			int r=j%i;
			sum[r]=(sum[r]+dp[i-1][j])%mod;
			if(j-(k+1)*i>=0) sum[r]=(sum[r]-dp[i-1][j-(k+1)*i]+mod)%mod;
			dp[i][j]=sum[r];
		}
	}
	for(int x=1;x<=n;x++) {
		int ans=0,l=x-1,r=n-x;
		for(int i=0;i<=n*n*k;i++) ans=(ans+1ll*dp[r][i]*dp[l][i])%mod;
		ans=(1ll*ans*(k+1)-1+mod)%mod;
		cout<<ans<<'\n';
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,l,r) for(int i=l;i<r;i++)
const int inf=2e9+10;
const int INF=9e18+10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const ll MOD=1e9+7;

const ll tmax=200000;

int main(){
    int h,w;cin>>h>>w;
    char s[h][w];
    rep(i,h)rep(j,w){
        cin>>s[i][j];
    }
    ll dp[h][w];
    rep(i,h)rep(j,w)dp[i][j]=0;
    dp[h-1][w-1]=1;
    ll plusw=1;
    ll plush[w];
    rep(i,w)plush[i]=0;
    plush[w-1]=1;
    int plusd[h+w-1];
    rep(i,h+w-1)plusd[i]=0;
    plusd[w-1]=1;
    for(int i=h-1;i>=0;i--)for(int j=w-1;j>=0;j--){
        if(i==h-1&&j==w-1)continue;
        if(s[i][j]=='#'){
            plusw=0;
            plush[j]=0;
            plusd[j+h-1-i]=0;
            continue;
        }
        dp[i][j]+=plusw;
        dp[i][j]%=MOD;
        /*for(int k=j+1;k<w&&s[i][k]=='.';k++){
            dp[i][j]+=dp[i][k];
            dp[i][j]%=MOD;
        }
        */
        dp[i][j]+=plush[j];
        dp[i][j]%=MOD;

        dp[i][j]+=plusd[j+h-1-i];
        dp[i][j]%=MOD;

        plusw+=dp[i][j];
        plusw%=MOD;
        plush[j]+=dp[i][j];
        plush[j]%=MOD;
        if(j==0)plusw=0;
        plusd[j+h-1-i]+=dp[i][j];
        plusd[j+h-1-i]%=MOD;
    }
    /*
    rep(i,h){
        rep(j,w)cout<<" "<<dp[i][j];
        cout<<endl;
    }
    */
    cout<<dp[0][0]<<endl;
    return 0;
}