program mason(f1,f2);
var
f1,f2:text;
p:longint;
q,t,l:longint;
a:array [1..500] of integer;
i:longint;
begin
assign (f1,'mason.in');
reset (f1);
assign (f2,'mason.out');
rewrite (f2);
readln (f1,p);
a[1]:=1;
for i:=2 to 500 do
a[i]:=0;
t:=1;
q:=p;
while (p>0) do
begin
p:=p-1;
if (t<500) then l:=t else l:=500;
for i:=1 to l do
a[i]:=a[i]*2;
for i:=1 to l do
begin
a[i+1]:=a[i+1]+a[i] div 10;
a[i]:=a[i] mod 10;
end;
if (a[l+1]<>0) and (l<500) then begin l:=l+1; t:=l;end;
end;
writeln(f2,(trunc(ln(2)/ln(10)*q)+1));
a[1]:=a[1]-1;
for i:=500 downto 1 do
begin
write(f2,a[i]);
if (i mod 50=1) then writeln(f2);
end;
close (f1);
close (f2);
end.