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
45
46
47
48
49
50
51
52
#include<bits/stdc++.h>

#include<cstdio>
using namespace std;

#define R(p, k) for(int i = p; i <= k; i++)
#define RI(i, p, k) for(int i = p; i <= k; i++)
#define IR(k, p) for(int i = k; i >= p; i--)
#define IRI(i, p, k) for(int i = k; i >= p; i--)
#define DEB 0
	
#if DEB
	#define EPRLL(a) fprintf(stderr, "%s %lld ", #a, a);
	#define EPR(a) fprintf(stderr, "%s %d ", #a, a);
	#define EPRN fprintf(stderr, "\n");
#else
  #define EPR(a)
	#define EPRLL(a)
  #define EPRN 
#endif

const int MN=1e6+5;
int n, m, t;

int main(){
  scanf("%d", &t);
  RI(j, 0, t-1){
    scanf("%d", &n);
    int close=0;
    int ones=1;
    while(n>1){
      if(n & 1){
        printf("(1+(1+1)*");
        close++;
        ones+=3;
      }
      else{
        printf("(1+1)*");
        ones+=2;
      }
        n=n>>1;
    }
    printf("1");
    R(1, close)
      printf(")");
    printf("\n");
    EPR(ones); EPRN;
  }


  return 0;
}