program bly(input,output);
type
t1=array[1..501] of integer;
Var
f1,f2:text;
c,i,j,p:longint;
num1,num2:t1;
begin
assign(f1,'mason.in');
assign(f2,'mason.out');
reset(f1);
rewrite(f2);
readln(f1,p);
for i:=1 to 500 do
num1[i]:=0;
num1[1]:=2;
for j:=2 to p do begin
num2:=num1; c:=0;
for i:=1 to 500 do begin
num1[i]:=num1[i]+num2[i]+c;
c:=num1[i] div 10;
num1[i]:=num1[i] mod 10;
end;
end;
num1[1]:=num1[1]-1;
writeln(f2,trunc(p*ln(2)/ln(10))+1);
j:=0;
for i:=500 downto 1 do begin
j:=j+1;
write(f2,num1[i]);
if j=50 then begin
writeln(f2);
j:=0;
end;
end;
close(f2);
close(f1);
end.