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
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
#include <string>

using namespace std;

void run_test(int k) {
  string exp = "";
  int open = 0;
  while (k > 0) {
    if (k == 1) {
      exp += "1";
      k = 0;
    } 
    else if (k == 2) {
      exp += "(1+1)";
      k = 0;
    }
    else if (k % 2 == 0) {
      exp += "(1+1)*";
      k = k / 2;
    }
    else {
      exp += "(1+";
      open++;
      k--;
    }
  }
  for (int i = 0; i < open; i++) {
    exp += ")";
  }
  printf("%s\n", exp.c_str());
}

int main() {
int t, k;

scanf("%d", &t);
for (int i = 0; i < t; i++) {
  scanf("%d", &k);
  run_test(k);
}

return 0;
}