program mason(f1,f2);
var
a:array[1..500]of integer;
i,j,p,h,x,y,k:integer;
f1,f2:text;
begin
assign(f1,'mason.in');
assign(f2,'mason.out');
reset(f1); rewrite(f2);
read(f1,p);
for i:= 1to 500 do a[i]:=0;
a[1]:=2;
if p>1 then begin
for i:=1 to p-1 do begin
j:=1; h:=500; k:=0;
while (k=0) and (h>=0) do begin
if a[h]<>0 then k:=h
else h:=h-1;
end;
for j:= 1 to k+1 do begin
x:=a[j]+a[j]+y;
a[j]:=x mod 10;
y:=x div 10;
end;
end;
end;
h:=500; k:=0;
while (k=0) and (h>=0) do begin
if a[h]<>0 then k:=h
else h:=h-1;
end;
writeln(f2,k);
j:=1;
for i:=500 downto 1 do begin
write(f2,a[i],' ');
if j=50 then begin j:=0; writeln(f2); end;
j:=j+1;
end;
close(f1); close(f2);
end.