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
#include <cstdio>
#include <vector>
#include <string>

using namespace std;

vector<string> results;

void run(int num) {
  if (num == 1) {
    results.push_back("1");
    return;
  }
  if (num) {
    if (num % 2) {
      results.push_back("(1+");
      run(num - 1);
      results.push_back(")");
    } else {
      results.push_back("(1+1)*");
      run(num / 2);
    }
  }
}

int main() {
  int n;
  scanf("%d", &n);

  while (n--) {
    int a;
    scanf("%d", &a);
    run(a);

    for (string s : results) {
      printf("%s", s.c_str());
    }

    printf("\n");
    results.clear();
  }
}