Problem: Using the given four integers from 1 to 9, we create an expression that gives an answer of 10. When you enter four integers a, b, c, d, write a program that outputs an expression that gives an answer of 10 according to the following conditions. Also, if there are multiple answers, only the first answer found will be output. If there is no answer, output 0.

* Use only addition (+), subtraction (-), and multiplication (*) as operators. Do not use division (/). You can use three operators.
* You must use all four numbers.
* You can freely change the order of the four numbers.
* You can use parentheses. You can use up to 3 sets (6) of parentheses.



Input

Given multiple datasets. The format of each dataset is as follows:


a b c d

Input ends with four 0s. The number of datasets does not exceed 40.

Output

For each dataset, combine the given four integers with the above arithmetic symbols and parentheses to output an expression or 0 with a value of 10 on one line. The expression string must not exceed 1024 characters.

Example

Input

8 7 9 9
4 4 4 4
5 5 7 5
0 0 0 0


Output

((9 * (9 - 7)) - 8)
0
((7 * 5) - (5 * 5))

Solution (in CPP):

Solution:
#include<iostream>
#include<cstdlib>
#include<stack>
#include<string>

const int N = 4;
const char *oprs = "+-*";
int operands[N];
int bExist = false;

using namespace std;

int generateExpression(int *oprpos, int *opr, int *operand, int n, int *e){
	int t = 0;
	int eIndex = 0;
	int nextOperand = 0;

	e[eIndex++] = operands[operand[nextOperand++]];
	e[eIndex++] = operands[operand[nextOperand++]];
	for(int i = 0; i < n - 1; i++){
		for(int j = t; j < oprpos[i] + t; j++){
			e[eIndex++] = oprs[opr[j]];
		}
		if( i < n - 2 ){
			e[eIndex++] = operands[operand[nextOperand++]];
		}
		t += oprpos[i];
	}
	return eIndex;
}

int calculateExpression( int *e, int esize, string &answer ){
	int i = 0;
	stack< int > st;
	stack< string > sst;
	int ret = 0;

	for(int i = 0; i < esize; i++){
		int t, t1, t2;
		string exp, exp1, exp2;
		char opr;
		opr = e[i];

		if( opr == '+' || opr == '-' || opr == '*' ){
			exp1 = sst.top();	sst.pop();
			exp2 = sst.top();	sst.pop();
			switch( opr ){
				case '+':
					t1 = st.top();	st.pop();
					t2 = st.top();	st.pop();
					t = t1 + t2;
					st.push( t );
					break;
				case '-':
					t2 = st.top();	st.pop();
					t1 = st.top();	st.pop();
					swap( exp1, exp2 );
					t = t1 - t2;
					st.push( t );
					break;
				case '*':
					t1 = st.top();	st.pop();
					t2 = st.top();	st.pop();
					t = t1 * t2;
					st.push( t );
					break;
			}
			exp = '(';exp+=exp1;exp+=' ';exp+=opr;exp+=' ';exp+=exp2;exp+=')';
			sst.push( exp );
		}else{
			char stroperand[32];
			sprintf( stroperand, "%d", opr);
			st.push( opr );
			sst.push( stroperand );
		}
	}
	ret = st.top();
	answer = sst.top();
	return ret;
}

void permit_operand(int *flag, int *p, int rest, int n, int *opr, int *oprpos){
	int t = 0;
	for(int i = 0; i < n; i++ ){
		if( flag[i] ){
			t++;
		}
	}
	if( t == n ){
		// TODO
		int e[N*2], esize;
		string expr;

		esize = generateExpression( oprpos, opr, p, n, e);
		if( calculateExpression( e, esize, expr ) == 10 ){
			if( !bExist ){
				bExist = true;
				cout << expr << '\n';
			}
		}
		return ;
	}

	for(int i = 0; i < n; i++ ){
		if( flag[i] ){
			continue;
		}else{
			flag[i] = 1;
			p[n - rest] = i;
			permit_operand(flag, p, rest - 1, n, opr, oprpos);
			flag[i] = 0;
		}
	}
}

void rawcomb_opr(int *p, int rest, int n, int *oprpos){
	if( rest == 0 ){
		// TODO
		int flag[N] = {0,};
		int operand[N];
		permit_operand( flag, operand, N, N, p, oprpos );
		return ;
	}
	for(int i = 0; i < n; i++){
		p[n - rest] = i;
		rawcomb_opr(p, rest - 1, n, oprpos);
	}
}

void rawcomb_oprpos(int *p, int rest, int n){
	if( rest == 0 ){
		// TODO
		int t = 0;
		for(int m = 0; m < n - 1; m++){
			t += p[m];
			if( t > m + 1 ){
				return ;
			}
		}
		if( t == n - 1 ){
			int opr[N];
			rawcomb_opr( opr, 3, 3, p );
		}
		return ;
	}
	for(int i = 0; i < n + 1 - rest; i++){
		p[(n - 1) - rest] = i;
		rawcomb_oprpos(p, rest - 1, n);
	}
}

int main(void){
	while(true){
		int end = 0;
		int p[N];

		for(int i = 0; i < N; i++){
			cin>>operands[i];
			end |= operands[i];
		}
		if( end == 0 ){
			break;
		}
		bExist = false;
		rawcomb_oprpos(p, N - 1, N);
		if( !bExist ){
			cout << "0\n";
		}
	}
	return 0;
}