#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define read read1<ll>()
# define Type template<typename T>
Type T read1(){
	T t=0;
	char k;
	bool vis=0;
	do (k=getchar())=='-'&&(vis=1);while('0'>k||k>'9');
	while('0'<=k&&k<='9')t=(t<<3)+(t<<1)+(k^'0'),k=getchar();
	return vis?-t:t;
}
# define fre(k) freopen(k".in","r",stdin);freopen(k".out","w",stdout)
const int N=90;
ll fib[135],s;
vector<pair<int,int> >ans;
int main(){s=read;
	fib[1]=fib[0]=1;
	for(int i=2;i<=N;++i)fib[i]=fib[i-1]+fib[i-2];
	if(s==1)return printf("1\n1"),0;
	vector<int>ve;
	for(int i=N;i&&s;--i)
		if(fib[i]<=s){
			ve.push_back(i);
			s-=fib[i];
		}
	for(int i=1;i<ve.size();++i)
		if(ve[0]-ve[i]&1)
			ans.push_back(make_pair(ve[0]-ve[i],1));
		else ans.push_back(make_pair(ve[0]-ve[i],2));
	for(int i=1;i<ve[0];++i)
		ans.push_back(make_pair(i,i&1?4:3));
	ans.push_back(make_pair(-1,1));
	ans.push_back(make_pair(-1,2));
	sort(ans.begin(),ans.end());
	if(~ve[0]&1)
		for(int i=0;i<ans.size();++i)
			if(ans[i].second<=2)ans[i].second=3-ans[i].second;
			else ans[i].second=7-ans[i].second;
	cout<<ans.size()<<endl;ll l=0,r=0;
	for(int i=0;i<ans.size();++i)printf("%d\n",ans[i].second)/*,ans[i].second==1?++l:ans[i].second==2?++r:ans[i].second==3?l+=r:r+=l*/;
//	cout<<l<<' '<<r<<endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

const int N = 101;

int dp[N][N * N * N], cnt[N];
int n, k, mod;

void upd(int & var, int val) {
  var += val;
  if (var >= mod)
    var -= mod;
}

int main() {
  scanf("%d %d %d", &n, &k, &mod);
  dp[0][0] = 1;
  int sum = 0;
  for (int x = 1; x <= n; ++x) {
    memset(cnt, 0, sizeof cnt);
    sum += k * x;
    int full = k * x;
    for (int j = 0, z = 0; j <= sum; ++j) {
      int now = dp[x-1][j];
      upd(cnt[z], now);
      dp[x][j] = cnt[z];
      if (j >= full) {
        upd(cnt[z], mod - dp[x-1][j-full]);
      }
      ++z;
      if (z >= x)
        z -= x;
    }
  }
  for (int i = 1; i <= n; ++i) {
    int lef = i - 1, rig = n - i;
    long long ans = 0;
    for (int j = 0; j <= sum; ++j) {
      ans = (ans + 1LL * dp[lef][j] * dp[rig][j]) % mod;
    }
    ans = (ans * (k+1) - 1) % mod;
    if (ans < 0)
      ans += mod;
    printf("%lld\n", ans);
  }
  return 0;
}
