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

vector<char> v;

void f(int x){
	if(x == 2){
		v.push_back('('); v.push_back('1'); v.push_back('+'); v.push_back('1'); v.push_back(')');
	}
	else if(x % 2 == 0){
        v.push_back('('); v.push_back('1'); v.push_back('+'); v.push_back('1'); v.push_back(')');
		v.push_back('*'); if(x % 4 != 0) v.push_back('(');
		f(x / 2);
		if(x % 4 != 0) v.push_back(')');
	}
	else
	{
		v.push_back('1'); v.push_back('+');
		f(x - 1);
	}
}

int main()
{
	int t; scanf("%d", &t);

	while(t--){
		int in; cin >> in;
		if(in == 1)
            cout << "1\n";
        else if(in == 2)
            cout << "1+1\n";
        else
        {
            f(in);
            for(char x : v)
                cout<<x;
            cout << endl;
            v.clear();
        }
	}
}