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

using namespace std;

string solve(int k) {
    string result;

    int open_parens = 0;

    while (k > 1) {
        int new_k = k / 2;
        if (new_k * 2 < k) {
            result += ")1+";
            open_parens++;
        }
        result += ")1+1(*";
        k = new_k;
    }

    result += "1";

    for (int i = 0; i < open_parens; i++) {
        result += "(";
    }

    reverse(result.begin(), result.end());
    return result;
}

int main() {
    int t;
    cin >> t;

    for (int i = 0; i < t; i++) {
        int k;
        cin >> k;

        cout << solve(k) << endl;
    }
}