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

public class jed {

	static String add(String s1, String s2) {
		return "(" + s1 + "+" + s2 + ")";
	}
	
	static String mul(String s1, String s2) {
		return "(" + s1 + "*" + s2 + ")";
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		
		
		for (int i = 0; i < t; i++) {
			int k = scan.nextInt();
			Deque<String> stack = new LinkedList<>();
	
			while (k > 1) {
				if (k % 2 == 0) {
					k /= 2;
					stack.addLast("*");
				} else {
					k--;
					stack.addLast("+");
				}
			}
			
			//int numbers1 = 1;
			String result = "1";
			while(!stack.isEmpty()) {
				String last = stack.removeLast();
				if (last.equals("*")) {
					result = mul(result, "(1+1)");
					//numbers1 += 2;
				} else {
					result = add(result, "1");
					//numbers1++;
				}
						
			}
			//System.out.println(numbers1);
			System.out.println(result);
		}
	}

}