program mason;
type
fxz1=array[0..502]of integer;
Var
f1,f2:text;
i,j,p,q:longint;
l,ans,c:fxz1;
procedure mul(x,y:fxz1;var c:fxz1);
var
i,j,k:longint;
begin
for i:=1 to 501 do c[i]:=0;
for i:=1 to 501 do
begin for j:=1 to 501 do
if i+j<=501 then c[i+j]:=x[i]*y[j]+c[i+j];end;
for i:=2 to 501 do
begin c[i+1]:=c[i] div 10 +c[i+1];
c[i]:=c[i] mod 10;
c[i-1]:=c[i];
end;
end;
begin
assign(f1,'mason.in');
assign(f2,'mason.out');
reset(f1);rewrite(f2);
readln(f1,p);
for i:=1 to 500 do
begin l[i]:=0;ans[i]:=0;c[i]:=0;end;
ans[1]:=1;l[1]:=2;
q:=p;
while p<>0 do
begin
if p mod 2=1 then begin c:=ans;mul(c,l,ans);end;
p:=p div 2;
c:=l;mul(c,c,l);
end;
ans[1]:=ans[1]-1;
writeln(f2,trunc(q*ln(2)/ln(10))+1);
j:=0;
for i:=500 downto 1 do
begin
j:=j+1;
write(f2,ans[i]);
if j=50 then begin writeln(f2);j:=0;end;
end;
close(f2);close(f1);
end.