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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Math.max;

public class jed {
    BufferedReader rd;

    jed() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        int t = pint();
        StringBuilder buf = new StringBuilder();
        for(int i=0;i<t;i++) {
            int n = pint();
            if(i > 0) {
                buf.append('\n');
            }
            buf.append(solve(n));
        }
        out(buf);
    }

    private String solve(int n) {
        StringBuilder buf = new StringBuilder();
        solve(n, buf);
        return buf.toString();
    }

    private void solve(int n, StringBuilder buf) {
        if(n == 1) {
            buf.append('1');
        } else if(n > 1) {
            solve(n / 2, buf);
            buf.insert(0, '(');
            buf.append("*(1+1))");
            if (n % 2 == 1) {
                buf.insert(0, '(');
                buf.append("+1)");
            }
        }
    }

    private int pint() throws IOException {
        return pint(rd.readLine());
    }

    private int pint(String s) {
        return Integer.parseInt(s);
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new jed();
    }
}