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
#include <stdio.h>

int main() {
	int t,k,i,brackets;
	scanf("%d", &t);
	for (i=0; i<t; ++i) {
		scanf("%d", &k);
		brackets=0;
		while (1) {
			if (k==0) {
				break;
			}
			else if (k==1) {
				printf("1");
				k--;
			}
			else if (k%2==1) {
				printf("(1+");
				brackets++;
				k--;
			}
			else {
				printf("(1+1)*");
				k/=2;
			}
		}
		for (;brackets>0;brackets--) {
			printf(")");
		}
		printf("\n");
	}
	return 0;
}