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

using namespace std;

int n, t;
vector<char> v;

void go(int x)
{
    if(x == 1)
    {
        v.push_back('1');
        return;
    }
    if(x == 2)
    {
        v.push_back('(');
        v.push_back('1');
        v.push_back('+');
        v.push_back('1');
        v.push_back(')');
        return;
    }
    if(x == 3)
    {
        v.push_back('(');
        v.push_back('1');
        v.push_back('+');
        v.push_back('1');
        v.push_back('+');
        v.push_back('1');
        v.push_back(')');
        return;
    }
    v.push_back('(');
    go(x / 2);
    v.push_back('*');
    v.push_back('(');
    v.push_back('1');
    v.push_back('+');
    v.push_back('1');
    v.push_back(')');
    if(x % 2 == 1) v.push_back('+'), v.push_back('1');
    v.push_back(')');
}

int main()
{
    scanf("%d", &t);
    while(t--)
    {
        scanf("%d", &n);
        v.clear();
        go(n);
        for(int i = 0; i < (int)v.size(); i++)
            printf("%c", v[i]);
        puts("");
    }
    return 0;
}