program mason;
type
arraytype=array [1..2000] of longint;
var
ans,binary:arraytype;
s,i,len,j,p,temp:longint;
procedure djgj;
var
x,i:longint;
begin
x:=0;
for i:=1 to 500 do
begin
x:=x+ans[i]*2;
ans[i]:=x mod 10;
x:=x div 10;
end;
end;
procedure gjgj;
var
i,j:longint;
x:longint;
ans1:arraytype;
begin
fillchar(ans1,sizeof(ans1),0);
for i:=1 to 500 do
begin
x:=0;
for j:=1 to 500 do
begin
x:=ans[i]*ans[j]+x div 10+ans1[i+j-1];
ans1[i+j-1]:=x mod 10;
end;
ans1[i+j]:=x div 10;
end;
ans:=ans1;
end;
begin
assign(input,'mason.in');reset(input);
assign(output,'mason.out');rewrite(output);
fillchar(ans,sizeof(ans),0);
readln(p);
len:=0;temp:=p;
while temp<>0 do
begin
len:=len+1;
binary[len]:=temp mod 2;
temp:=temp div 2;
end;
ans[1]:=1;
for i:=len downto 1 do
begin
gjgj;
if binary[i]=1 then djgj;
end;
s:=trunc(p*(ln(2)/ln(10)))+1;
writeln(s);
ans[1]:=ans[1]-1;
for i:=500 downto 1 do
begin
write(ans[i]);
if i mod 50=1 then writeln;
end;
close(input);close(output);
end.