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 <iostream>
using namespace std;

void gen2n(int n) {
  if(n==0) {
    cout<<"1";
    return;
  }
  for(int i=0;i<n;i++) {
    cout<<"(1+1)";
    if(i<n-1)
     cout<<"*";
  }
}

void gen( int n) {
  int bmap[100] = {0};
  int bptr = 0;
  while(n>0) {
    bmap[bptr++] = n%2;
    n/=2;
  }
  bool prev = false;
  for(int i=0;i<100;i++) {
    if(bmap[i]==1) {
      if(prev) 
      cout<<"+";
      gen2n(i);
      prev = true;
    } 
  }
  cout<<endl;
}

int main() {
  int k,n;
  cin>>k;
  for(int i=0;i<k;i++) {
    cin>>n;
    gen(n);
    
  }
  return 0;
}