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
#include <cstdio>

using namespace std;

void printOneRepresentation(int k, bool first) {
    if (k == 1) {
        printf("1");
    } else {
        if (k & 1 == 1) {
           printf(first ? "1+" : "(1+");
        }
        if ((k >> 1) > 1) {
            printf("(1+1)*");
            printOneRepresentation(k >> 1, false);
        } else {
            printf(first || k == 3 ? "1+1" : "(1+1)");
        }
        if (k & 1 == 1) {
           printf(first ? "" : ")");
        }
    }
}

void test() {
    int k;
    scanf("%d ", &k);
    printOneRepresentation(k, true);
    printf("\n");
}

int main() {
    int t;

    #ifdef _PA_USE_TEST_INPUT_FILE_
    freopen("input.txt","rt",stdin);
    #endif

    scanf("%d ", &t);

    for (int i = 0; i < t; i++) {
        test();
    }

    return 0;
}