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
#include<bits/stdc++.h>
using namespace std;

string f(int n)
{
	if (n == 1)
		return "1";

	string x = f(n/2);
	if (n % 2 == 0)
		return x + "*(1+1)";	
	else
		return "(" + x + "*(1+1)+1)";
}

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