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>

int f(int n) {
  if (n <= 2) return n;
  if (n & 1) return f(n / 2) + 3;
  else return f(n / 2) + 2;
}

std::string run(int n) {
  if (n == 2) return "1+1";
  if (n == 3) return "1+1+1";
  if (n == 1) return "1";
  if (n & 1) return "(" + run(n / 2) + ")*(1+1)+1";
  else return "(" + run(n / 2) + ")*(1+1)";
}

int main() {
  int T, n; 
  std::cin >> T;
  for (int cas = 1; cas <= T; ++cas) {
    std::cin >> n;
    std::cout << run(n) << std::endl;
  }
  return 0;
}