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
38
39
40
41
42
43
44
#include <cstdlib>
#include <iostream>
using namespace std;

int main()
{
    int t, k;
    cin>>t;
    while(t)
    {
        cin>>k;
        string equ="";
        int np = 0, jed=0;
        bool first=true;
        if(k==1) equ+="1";
        while(k>1){
            if(k%2)
            {
                equ+="(1";
                jed++;
                if(k>1)
                    equ+="+";
                np++;
                k--;
            }
            equ+="(1+1)";
            jed+=2;
            if(k>2)
                equ+="*";
            k=k/2;
        }
        for(int i=0; i<np; i++)
        {
            equ+=")";
        }
        if(jed>100)
            cout<<"NIE"<<endl;
        else
            cout<<equ;
        cout<<endl;
        t--;
    }
    return 0;
}