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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,n) for(int i=0; i < int(n); ++i)
#define FO(i,a,b) for(int i=int(a); i<int(b); ++i)

typedef long long ll;
typedef pair<int,int> pii;

typedef vector<int> vi;
typedef vector<vi> vvi;

#define siz size()*1LL

#define fi first
#define se second

#define ASS assert

#define remin(a,b) a=min(a,b)
#define remax(a,b) a=max(a,b)

#define ALL(c) (c).begin(), (c).end()

#define NL '\n'


void tc(){
	int n;
	cin >> n;
	
	int numn = 0;
	
	bool first_pass = true;
	
	while(n){
		int digit = n%2;
		if(n == 1) cout << "1";
		else if(n%2 == 1){
			if(!first_pass){
				cout << "(";
				++numn;
			}
			cout << "1";
		}
		
		n /= 2;
		
		if(n){
			if(digit) cout << "+";
			cout << "(1+1)*";
		}
		
		first_pass = false;
	}
	
	FOR(i,numn) cout << ")";
	cout << NL;
}

int main(){
	ios_base::sync_with_stdio(0);
	
	int t;
	cin >> t;
	FOR(i,t) tc();
	
	return 0;
}