program mason;
var ms:array[1..501]of integer;
i,j,p,max:longint;
f1:text;
begin
assign(f1,'mason.in');
reset(f1);
readln(f1,p);
close(f1);
ms[1]:=2;
max:=1;
for i:=2 to p do
begin
ms[501]:=0;
for j:=1 to max do
ms[j]:=ms[j]*2;
for j:=1 to max do
begin
if ms[j]>=10 then
begin
ms[j+1]:=ms[j+1]+1;
ms[j]:=ms[j]-10;
end;
end;
if ms[max+1]<>0 then inc(max);
if max>500 then max:=500;
end;
assign(f1,'mason.out');
rewrite(f1);
writeln(f1,trunc(p*ln(2)/ln(10)+1));
write(f1,ms[500]);
for i:=499 downto 2 do
begin
if i mod 50=0 then writeln(f1);
write(f1,ms[i]);
end;
writeln(f1,ms[1]-1);
close(f1);
end.