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
import java.util.Scanner;

public class jed {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int k = sc.nextInt();
            if (k == 1) {
                System.out.println("1");
                continue;
            }
            int parentheses = 0;
            StringBuilder sb = new StringBuilder();
            while (k > 1) {
                if (k % 2 == 0) {
                    sb.append("(1+1)");
                    k /= 2;
                    if (k > 1) {
                        sb.append("*");
                    }
                } else {
                    sb.append("(1");
                    parentheses++;
                    k--;
                    if (k > 0) {
                        sb.append("+");
                    }
                }
            }
            while (parentheses-- > 0) {
                sb.append(")");
            }
            System.out.println(sb);
        }
    }
}