#include<bits/stdc++.h>
using namespace std;
int aa[100000],bb[100000],cc[100000];
void gjd(int a[],int b[],int c[]){
memset(c,0,sizeof(c));
for(int x=1;x<=500;x++)
{
for(int y=1;y<=500;y++)
{
if(a[x]*b[y]+c[x+y-1]>=10)
c[x+y]+=(a[x]*b[y]+c[x+y-1])/10;
c[x+y-1]=(a[x]*b[y]+c[x+y-1])%10;
}
}
for(int i=1;i<=500;i++){
a[i]=c[i];
}
}
int main()
{
aa[1]=1;
bb[1]=2;
long long n;
cin >> n;
cout << (int)(log10(2)*n+1) << endl;
while(n){
if(n&1)
{
gjd(aa,bb,cc);
}
gjd(bb,bb,cc);
n >>=1;
}
aa[1]-=1;
for(int x=500;x>0;x--)
{
if(x%50==0&&x!=500) cout << endl;
cout << aa[x];
}
return 0;
}