program z2;
var k,x,z,i,u,q:integer; t1,t2:text; s,c:char; m:array[1..16000] of integer;
n:array[1..16000] of integer;
begin
i:=1;
assign(t1,'input.txt');
assign(t2,'output.txt');
reset(t1); rewrite(t2);
     while not eoln(t1) do begin read(t1,m[i]); n[i]:=m[i]; i:=i+1; end;
if (i mod 2)=1 then i:=i-1; q:=i;
repeat
i:=i div 2;  writeln;
for u:=1 to i do
n[u]:=m[2*u-1]+m[2*u];
for u:=1 to i do
n[u+i]:=m[2*u-1]-m[2*u];
writeln;
for u:=1 to i*2 do begin m[u]:=n[u]; n[u]:=m[u];  write(' ',m[u]); end;
until i=1;
for u:=1 to q do begin write(t2,m[u]); write(t2,' '); end;
close(t1); close(t2);
end.