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
#include <iostream>
#include <string>

using namespace std;

string output(int n) {
	if (n==0) return "";
	if (n==1) return "1";
	if (n==2) return "(1+1)";
	if (n==3) return "(1+1+1)";
	if (n==4) return "(1+1+1+1)";
	if (n&1) return "((1+1)*" + output(n>>1) +"+1)";
	else return "(1+1)*" + output(n>>1);
}

int main() {
	int a, t;
	cin>>t;
	for (int j = 1; j<=t; j++) {
		cin>>a;
		cout<<output(a)<<endl;
	}

//	for (int i = (1<<30)-1; i<(1<<30); i++)
//		cout<<i<<" "<<output(i)<<endl;
	return 0;
}