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

using namespace std;

typedef long long int LL;

 void printDirect(LL n)
 {
    if (n==6) cout << "(1+1)*(1+1+1)";
    else if (n==7) cout << "(1+1)*(1+1+1)+1";
    else if (n==8) cout << "(1+1)*(1+1+1+1)";
    else if (n==9) cout << "(1+1+1)*(1+1+1)";
    else if (n==10) cout << "(1+1+1)*(1+1+1)+1";
    else if (n==11) cout << "(1+1+1)*(1+1+1)+1+1";
    else if (n==12) cout << "(1+1+1)*(1+1)*(1+1)";
    else
    {
		for(int i=0; i<n-1; i++)
			cout << "1+";
		cout << "1";
    }
 }

 void rec(LL k)
 {
    if (k <= 12){
		printDirect(k);
		return;
    }
    for(int i=12; i>1; i--)
		if (! (k%i)) {
			cout << "(";
			printDirect(i);
			cout << ")*(";
			rec(k/i);
			cout << ")";
			return;
	}
	rec(k-1);
    cout << "+1";
 }

 void solve(LL k)
 {
    if (k<=100)
    {
		printDirect(k);
		cout << endl;
		return;
    }
    rec(k);
    cout << endl;
    return;
 }


 main()
 {
    LL l,k;
    cin >> l;
    for(LL i=0; i<l; i++)
    {
	cin >> k;
	solve(k);
    }
    return 0;
 }