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
#include <cstdio>
#include <string>
using namespace std;

string solve(int n) {
  if (n == 1) {
    return "1";
  }
  if (n == 2) {
    return "1+1";
  }
  if (n % 2) {
    return "(" + solve(n-1) + ")+1";
  }
  return "(" + solve(n/2) + ")*(1+1)";
}

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