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
#include <bits/stdc++.h>

using namespace std;

string binary;

void to_bin(int k){
	if (k >> 1) to_bin (k >> 1);
	binary.push_back((k&1) + '0');
}	


int main(){
	int t, k;
	cin >> t;
	while (t--){
		cin >> k;
		if (k == 1){ cout << "1\n"; continue;}
		if (k == 2){ cout << "1+1\n"; continue;}
		binary.clear();
		to_bin(k);
		//int ile_1 = 2;
		int len = binary.size();
		//cout << binary << endl;
		for (int i = 2; i < len; ++i)
			cout << '(';
		cout << "1+1";	
		
		for (int i = 1; i < len-1; ++i){
			if (binary[i] == '1')
				cout << "+1)*(1+1)";//, ile_1 += 3;
			else cout << ")*(1+1)";//, ile_1 += 2;
		}
		if (binary[len-1] == '1') cout << "+1";
		cout /*<< "     " << ile_1*/ << endl;
	}
}