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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <iostream>


void printString( long int _i_value )
{
	int ind = 0;
	char c_out[500] = { 0 };
	long int i_counter(0);
	long int i_factor;
	long int i_value = _i_value;


	while( i_value > 1 )
	{
		i_factor = 2;
		while ( i_value % i_factor && i_factor <= ( i_value / 2 ) )
			++i_factor;


		if ( i_factor > ( i_value / 2 ) )
			i_factor = i_value;


		i_counter += i_factor;


		if ( i_counter > 100 )
		{
			std::cout << "NIE" << std::endl;
			return;
		}


		i_value /= i_factor;


		{
			//add * if already something inside
			if ( ind ) c_out[ ind++ ] = '*';

			//star this loop
			c_out[ ind++ ] = '(';

			for ( long int i = 0; i < i_factor; ++i )
			{
				//add plus if not first nmber
				if ( i ) c_out[ ind++ ] = '+';
				//add one
				c_out[ ind++ ] = '1';
			}

			//end this loop
			c_out[ ind++ ] = ')';
		}
	}

	std::cout << c_out << std::endl;
	return;
};


int main(void)
{
	srand(0);

	std::ios_base::sync_with_stdio(0);

	long int t;
	long int k;
	std::cin >> t;

	for ( long int i = 0; i < t; ++i )
	{
		std::cin >> k;
		printString( k );
	}

	return 0;
};