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
#include <cstdio>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main() {
	int t;
	scanf("%d", &t);
	REP(tt,t) {
		int k;
		scanf("%d", &k);
		if (k == 1) {
			printf("1\n");
			continue;
		}
		int c = 0;
		bool s = 1;
		while (k > 1) {
			if (!s) printf("*");
			if (k & 1) {
				printf("(1+");
				++c;
			}
			printf("(1+1)");
			s = 0;
			k >>= 1;
		}
		REP(i,c) printf(")");
		printf("\n");
	}
}