program ex;
var
a,b,c:array[1..maxint] of longint;
f1,f2:text;
i,j,p,k:longint;
procedure jk(x:longint);
var i,j:longint;
begin
if x<>0 then begin
jk(x div 2);
for i:=1 to 500 do
for j:=1 to 500 do
if x mod 2=0 then
c[i+j-1]:=a[i]*a[j]+c[i+j-1]
else c[i+j-1]:=a[i]*a[j]*2+c[i+j-1];
for k:=1 to 500 do begin
c[k+1]:=c[k+1]+(c[k] div 10);
a[k]:=c[k] mod 10;end;
fillchar(c,sizeof(c),0);
end;
end;
begin
assign(f1,'mason.in');reset(f1);
assign(F2,'mason.out');rewrite(F2);
read(f1,p);
writeln(f2,trunc(p*ln(2)/ln(10)+1));
fillchar(a,sizeof(a),0);
fillchar(c,sizeof(c),0);
a[1]:=1;
jk(p);
k:=0;a[1]:=a[1]-1;
for i:=500 downto 1 do begin
write(f2,a[i]);k:=k+1;
if k=50 then begin writeln(F2);k:=0;end;
end;
close(f1);
close(f2);
end.