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

std::string solve(int x) {
	if (x == 1) {
		return "1";
	} else if (x == 2) {
		return "(1+1)";
	}

	if (x % 2) {
		return "(" + solve(x - 1) + "+1)";
	} else {
		return "(" + solve(x / 2) + "*(1+1))";
	}
}

int main() {
	int t, x;

	scanf("%d", &t);
	for (int i = 0; i < t; ++i) {
		scanf("%d", &x);
		printf("%s\n", solve(x).c_str());
	}
}