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
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.Scanner;

public class jed {
  public static Scanner in;
  public static PrintWriter out;

  public static void setInput(InputStream in) {
    jed.in = new Scanner(in);
  }

  public static void setOutput(PrintStream out) {
    jed.out = new PrintWriter(new OutputStreamWriter(out));
  }

  public static void main(String[] args) throws Exception {
    try {
      Locale.setDefault(Locale.US);
    } catch (Exception e) {
    }
    if (in == null) {
      setInput(System.in);
    }
    if (out == null) {
      setOutput(System.out);
    }

    new jed().solve();
    out.flush();
  }

  int nextInt() {
    return in.nextInt();
  }

  String next() {
    return in.next();
  }

  String solve(int x) {
    if (x == 1) {
      return "1";
    }
    String x2 = "(1+1)*" + solve(x / 2);
    return x % 2 == 0 ? x2 : "(1+" + x2 + ")";
  }

  void solve() throws Exception {
    for (int q = nextInt(); q > 0; q--) {
      out.println(solve(nextInt()));
    }
  }
}