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
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

string solve( int k ) {
	
	if( k == 2 ) return "1+1";
	if( k == 1 ) return "1";
	if( k == 3 ) return "1+1+1";
	
	string s1 = solve(k/2);
	
	if( k % 2 == 1 ) {
		return "(1+1)*("+s1+")+1";
	} else {
		return "(1+1)*("+s1+")";
	}	
	
}

int main() {
	int q;
	scanf( "%d", &q );
	for(int i =0 ; i < q; i++) {
		int k;
		scanf( "%d", &k );
		printf( "%s\n", solve(k).c_str() );
	}
	return 0;
}