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
69
70
#include<string>
#include<stdio.h>
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<queue>
#include<bitset>
#define ll long long
#define pb push_back
#define sc scanf
#define pr printf
#define f first
#define s second
#define mp make_pair
#define lb lower_bound

using namespace std;

vector<char>wp[100];
int wt[100];

void wpi(int v,int x){
    if(x==1){
        wp[v].pb('1');
        return;
    }
    if((x&1)==1){
        wp[v].pb('1');
        wp[v].pb('+');
        wpi(v,x-1);
        return;
    }
    else{
        if(x!=2){
            wp[v].pb('(');
            wp[v].pb('1');
            wp[v].pb('+');
            wp[v].pb('1');
            wp[v].pb(')');
            wp[v].pb('*');
            wp[v].pb('(');
            wt[v]++;
            wpi(v,x>>1);
        }
        else{
            wp[v].pb('1');
            wp[v].pb('+');
            wp[v].pb('1');
        }
        return;
    }
    return;
}

int main (){
    int n,m,t;
    char c;
    scanf("%d",&t);
    for(int i=0;i<t;i++){
        scanf("%d",&n);
        wpi(i,n);
    }
    for(int i=0;i<t;i++){
        for(int j=0;j<wp[i].size();j++)pr("%c",wp[i][j]);
        for(int j=0;j<wt[i];j++)pr(")");
        pr("\n");
    }
    return 0;
}