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

std::string s;

void f(int n)
{
	if (n == 2)
	{
		s += "1+1";
		return;
	}
	if (n == 3)
	{
		s += "1+1+1";
		return;
	}
	if (n % 2 == 1)
		s += "1+";
	s += "(1+1)*(";
	f(n/2);
	s += ")";
}

int main()
{
	int t, n;
	scanf("%d", &t);
	while (t--)
	{
		scanf("%d", &n);
		s.clear();
		f(n);
		printf("%s\n", s.c_str());
	}
	return 0;
}