1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var
  i, k, t: Longint;
begin
  Read(t);
  repeat
    Read(k);
    i := 0;
    while k > 3 do
    begin
      if (k and 1) = 1 then
        Write('1+');
      Write('(1+1)*(');
      Inc(i);
      k := k shr 1;
    end;

    case k of
      1: Write('1');
      2: Write('1+1');
      3: Write('1+1+1');
    end;

    while i>0 do
    begin
      Write(')');
      Dec(i);
    end;

    Writeln;

    Dec(t);
  until t=0;
end.