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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;


public class Main {
	private	static	BufferedReader		br   = null;
	private	static	ArrayList<Integer>	nums = null;
	private	static	ArrayList<String>	hist = null;

	static {
		br   = new BufferedReader(new InputStreamReader(System.in));
		nums = new ArrayList<Integer>();
		hist = new ArrayList<String>();
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		while (parseNums() != -1) {
			int[]	tmps = new int[4];
			System.out.println(result(0, tmps));
			hist.clear();
		}
	}

	private static String result(int n, int tmps[]) {
		String	str = "0";
		int		len = nums.size();

		if (len == 0) {
			String curr = String.format("%d %d %d %d", tmps[0], tmps[1], tmps[2], tmps[3]);
			if (!hist.contains(curr)) {
				if ((str = calc1(tmps)).equals("0")) {
					str = calc2(tmps);
				}
				hist.add(curr);
			}
		}
		else {
			for(int i = 0; i < len && str.equals("0"); i++) {
				Integer	num = nums.get(i);
				nums.remove(i);
				tmps[n] = num;
				str = result(n + 1, tmps);
				nums.add(i, num);
			}
		}

		return str;
	}

	private static String calc1(int tmps[]) {
		String	res  = "0";
		int[]	ope  = new int[3];
		int[]	trm  = new int[2];
		boolean	loop = true;

		for (ope[0] = 0; ope[0] < 4 && loop; ope[0]++) {
			trm[0] = f(tmps[0], tmps[1], ope[0]);
			for (ope[1] = 0; ope[1] < 4 && loop; ope[1]++) {
				trm[1] = f(tmps[2], tmps[3], ope[1]);
				for (ope[2] = 0; ope[2] < 4 && loop; ope[2]++) {
					if (f(trm[0], trm[1], ope[2]) == 10) {
						res = fstr(fstr(String.valueOf(tmps[0]), String.valueOf(tmps[1]), ope[0]), fstr(String.valueOf(tmps[2]), String.valueOf(tmps[3]), ope[1]), ope[2]);
						loop = false;
					}
				}
			}
		}

		return res;
	}

	private static String calc2(int tmps[]) {
		String	res  = "0";
		int[]	ope  = new int[3];
		int[]	trm  = new int[2];
		boolean	loop = true;

		for (ope[0] = 0; ope[0] < 4 && loop; ope[0]++) {
			trm[0] = f(tmps[1], tmps[2], ope[0]);
			for (ope[1] = 0; ope[1] < 4 && loop; ope[1]++) {
				trm[1] = f(tmps[0], trm[0], ope[1]);
				for (ope[2] = 0; ope[2] < 4 && loop; ope[2]++) {
					if (f(trm[1], tmps[3], ope[2]) == 10) {
						res = fstr(fstr(String.valueOf(tmps[0]), fstr(String.valueOf(tmps[1]), String.valueOf(tmps[2]), ope[0]), ope[1]), String.valueOf(tmps[3]), ope[2]);
						loop = false;
					}
				}
			}
		}

		return res;
	}

	private static int f(int a, int b, int ope) {
		int	result = 0;

		switch (ope) {
		case 0:
			result = a + b;
			break;
		case 1:
			result = a - b;
			break;
		case 2:
			result = b - a;
			break;
		default:
			result = a * b;
			break;
		}

		return result;
	}
	
	private static String fstr(String a, String b, int ope) {
		String	result = "";

		switch (ope) {
		case 0:
			result = String.format("(%s + %s)", a, b);
			break;
		case 1:
			result = String.format("(%s - %s)", a, b);
			break;
		case 2:
			result = String.format("(%s - %s)", b, a);
			break;
		default:
			result = String.format("(%s * %s)", a, b);
			break;
		}

		return result;
	}
	
	private static int parseNums() {
		int		nStatus = -1;
		String	strIn   = null;

		nums.clear();
		if ((strIn = parseStdin()) != null) {
			String[]	aN = strIn.split(" ");
			for (int n = 0; n < aN.length; n++) {
				nums.add(Integer.decode(aN[n]));
			}
			nStatus = 0;
		}
		
		return nStatus;
	}

	private static String parseStdin() {
		String	strNum = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty() && !line.equals("0 0 0 0")) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}
}