1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
program potalgjedynki;
var
a, b, c, d, e, f: longint;
begin
readln(a);
for b:=1 to a do
begin
readln(c); d:=0;
while c>2 do
begin
if c mod 2=1 then begin write('1+'); dec(c) end else
if c mod 2=0 then begin write('(1+1)*('); inc(d); c:=c div 2 end
end;
write('1+1)'); for e:=1 to d-1 do write(')');
writeln
end
end.