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

void printJed(int k, bool op){
    if(k == 1){
        printf("1");
        return;
    }
    if(k == 2){
        if(op)printf("(1+1)");
        else printf("1+1");
        return;
    }

    if(k & 1){
        if(op)printf("(");
        printJed(k-1, 0);
        printf("+1");
        if(op)printf(")");
    }else{
        printJed(k/2, 1);
        printf("*(1+1)");
    }
}

int main(){
    int t;
    scanf("%d", &t);
    while(t--){
        int k;
        scanf("%d", &k);
        printJed(k, 0);
        printf("\n");
    }

    return 0;
}