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
#include <stdio.h>

void output(int n) {
  switch (n) {
  default:
    if (n % 2 == 1) {
      printf("1+");
    }
    printf("(1+1)*(");
    output(n / 2);
    printf(")");
    break;
  case 3:
    printf("1+");
  case 2:
    printf("1+");
  case 1:
    printf("1");
  case 0:
    break;
  }
}

int main() {
  int t;
  char buf[257];

  fgets(buf, sizeof buf, stdin);
  sscanf(buf, "%d", &t);
  for (int i = 0; i < t; ++i) {
    int k;
    fgets(buf, sizeof buf, stdin);
    sscanf(buf, "%d", &k);
    output(k);
    printf("\n");
  }
  return 0;
}