program mason(fin,fout);
var
fin,fout:text;
p:longint;
q,t,l,k,w:longint;
a:array [1..500] of integer;
c:array [1..101] of integer;
head,teal:integer;
i,j:longint;
begin
assign (fin,'mason.in');
reset (fin);
assign (fout,'mason.out');
rewrite (fout);
readln (fin,p);
a[1]:=1;
for i:=2 to 500 do
a[i]:=0;
t:=1;
{WORK}
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;{while}
{qiu wei shu}
c[1]:=1;
w:=30;
while (q>0) do
begin
q:=q-1;
for i:=1 to 30 do
c[i]:=c[i]*2;
for i:=1 to 30 do
begin
c[i+1]:=c[i+1]+c[i]div 10;
c[i]:=c[i] mod 10;
end;
if (c[31]<>0)
then begin
w:=w+1;
for i:=1 to 30 do
c[i]:=c[i+1];
c[31]:=0;
end;{if}
end;{while}
if (t<=30) then writeln(fout,t) else writeln(fout,w);
a[1]:=a[1]-1;
for i:=500 downto 1 do
begin
write(fout,a[i]);
if (i mod 50=1) then writeln(fout);
end;
close (Fin);
close (Fout);
end.