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
#include<bits/stdc++.h>
using namespace std;
void solve(int n, string &res)
  {
  if(n == 1)res = "1";
  if(n == 2)res = "(1+1)";
  if(n <= 2)return;
  if(n % 2 == 0)
    {
    solve(n/2, res);
    res += "*(1+1)";
    }
  else
    {
    solve(n/2, res);
    res = "(" + res + "*(1+1)+1)";
    }
  }
int main()
{
int z, n;
cin>>z;
while(z--)
  {
  cin>>n;
  string res;
  solve(n, res);
  cout<<res<<endl;
  }
}