program mason;
type
shuzu=array[1..500]of integer;
var
p:longint;
i,j,k,m,n,x,y:integer;
s,s1:string;
flag:boolean;
f1,f2:text;
z,z1,z2:shuzu;
begin
assign(f1,'mason.in');reset(f1);
assign(f2,'mason.out');rewrite(f2);
readln(f1,p);
y:=trunc(p*ln(2)/ln(10))+1;
for i:=1 to 500 do
z[i]:=0;
z[1]:=2;
for i:=2 to p do
begin
z1:=z;
for j:=1 to 500 do
begin
z[j]:=z[j]+z1[j]+x;
x:=z[j] div 10;
z[j]:=z[j] mod 10;
end;
end;
z[1]:=z[1]-1;
writeln(f2,y);
m:=0;
for i:=500 downto 1 do
begin
write(f2,z[i]);
m:=m+1;
if m=50 then begin writeln(f2); m:=0; end;
end;
close(f2);
end.