program mason(input,output,io);
var
p,i:longint;
s:Array[1..500]of byte;
j:integer;
io:text;
begin
s[1]:=2;
assign(io,'mason.in');
reset(io);
readln(io,p);
close(io);
for i:=2 to p do
begin
for j:=1 to 500 do
s[j]:=s[j]*2;
for j:=1 to 499 do
begin
s[j+1]:=s[j+1]+(s[j] div 10);
s[j]:=s[j]mod 10;
end;
end;
dec(s[1]);
assign(io,'mason.out');
rewrite(io);
writeln(io,trunc(p*ln(2)/ln(10)+1));
for j:=9 downto 0 do
begin
for i:=50 downto 1 do
write(io,s[j*50+i]);
writeln(io);
end;
end.