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
#include <cstdio>
#include <string>

int main() {
	int T;
	scanf("%d",&T);

	while (T-- > 0) {
		int k;
		std::string expr="";
		scanf("%d",&k);

		for (int i=30;i>=0;i--) {
			if (expr.size() > 0) {
				expr = "(" + expr + "*(1+1)" + ")";
			}

			if (k&(1<<i)) {
				if (expr.size() > 0) expr = "(" + expr + "+1" + ")";
				else expr = "1";
			}
		}
		printf("%s\n",expr.c_str());
	}

	return 0;
}