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.*;
import java.util.StringTokenizer;

class Researcher {
	int n[] = new int[4];

	Researcher(int n[],int n1,int n2,int n3,int n4) {
		this.n[0] = n[n1];
		this.n[1] = n[n2];
		this.n[2] = n[n3];
		this.n[3] = n[n4];
	}

	String FindPattern() {
		String t;
		t = pattern1(1,"",n[0]);
		if (t.equals("f")==false) return t;

		t = pattern2(2,"",n[3]);
		if (t.equals("f")==false) return t;

		t = pattern3(2,"",n[1]);
		if (t.equals("f")==false) return t;

		t = pattern4(2,"",n[1]);
		if (t.equals("f")==false) return t;

		t = pattern5(1,"",n[0],n[2]);
		if (t.equals("f")==false) return t;

		return "f";
	}

	String pattern1(int number,String s,int sum) { //number:1,sum:n[0]
		if (number<4) {
			String t = pattern1(number+1,s+"+",sum+n[number]);
			if (!t.equals("f")) return t;
			t = pattern1(number+1,s+"-",sum-n[number]);
			if (!t.equals("f")) return t;
			t = pattern1(number+1,s+"*",sum*n[number]);
			if (!t.equals("f")) return t;
		}
		else if (number==4) {
			if (sum==10) return "((("+n[0]+" "+s.charAt(0)+" "+n[1]+") "+s.charAt(1)+" "+n[2]+") "+s.charAt(2)+" "+n[3]+")";
			else return "f";
		}
		return "f";
	}

	String pattern2(int number,String s,int sum) { //number:2,sum:n[3]
		if (number>=0) {
			String t = pattern2(number-1,s+"+",n[number]+sum);
			if (!t.equals("f")) return t;
			t = pattern2(number-1,s+"-",n[number]-sum);
			if (!t.equals("f")) return t;
			t = pattern2(number-1,s+"*",n[number]*sum);
			if (!t.equals("f")) return t;
		}
		else if (number==-1) {
			if (sum==10) return "("+n[0]+" "+s.charAt(2)+" ("+n[1]+" "+s.charAt(1)+" ("+n[2]+" "+s.charAt(0)+" "+n[3]+")))";
			else return "f";
		}
		return "f";
	}

	String pattern3(int number,String s,int sum) { //number:2,sum:n[1]
		if (number==2) {
			String t = pattern3(0,s+"+",sum+n[2]);
			if (!t.equals("f")) return t;
			t = pattern3(0,s+"-",sum-n[2]);
			if (!t.equals("f")) return t;
			t = pattern3(0,s+"*",sum*n[2]);
			if (!t.equals("f")) return t;
		} else if (number==0) {
			String t = pattern3(3,s+"+",n[0]+sum);
			if (!t.equals("f")) return t;
			t = pattern3(3,s+"-",n[0]-sum);
			if (!t.equals("f")) return t;
			t = pattern3(3,s+"*",n[0]*sum);
			if (!t.equals("f")) return t;
		} else if (number==3) {
			String t = pattern3(-1,s+"+",sum+n[3]);
			if (!t.equals("f")) return t;
			t = pattern3(-1,s+"-",sum-n[3]);
			if (!t.equals("f")) return t;
			t = pattern3(-1,s+"*",sum*n[3]);
			if (!t.equals("f")) return t;
		} else if (number==-1) {
			if (sum==10) return "(("+n[0]+" "+s.charAt(1)+" ("+n[1]+" "+s.charAt(0)+" "+n[2]+"))"+" "+s.charAt(2)+" "+n[3]+")";
			else return "f";
		}
		return "f";
	}

	String pattern4(int number,String s,int sum) { //number:2,sum:n[1]
		if (number==2) {
			String t = pattern4(3,s+"+",sum+n[2]);
			if (!t.equals("f")) return t;
			t = pattern4(3,s+"-",sum-n[2]);
			if (!t.equals("f")) return t;
			t = pattern4(3,s+"*",sum*n[2]);
			if (!t.equals("f")) return t;
		} else if (number==3) {
			String t = pattern4(0,s+"+",sum+n[3]);
			if (!t.equals("f")) return t;
			t = pattern4(0,s+"-",sum-n[3]);
			if (!t.equals("f")) return t;
			t = pattern4(0,s+"*",sum*n[3]);
			if (!t.equals("f")) return t;
		} else if (number==0) {
			String t = pattern4(-1,s+"+",n[0]+sum);
			if (!t.equals("f")) return t;
			t = pattern4(-1,s+"-",n[0]-sum);
			if (!t.equals("f")) return t;
			t = pattern4(-1,s+"*",n[0]*sum);
			if (!t.equals("f")) return t;
		} else if (number==-1) {
			if (sum==10) return "("+n[0]+" "+s.charAt(2)+" (("+n[1]+" "+s.charAt(0)+" "+n[2]+")"+" "+s.charAt(1)+" "+n[3]+"))";
			else return "f";
		}
		return "f";
	}

	String pattern5(int number,String s,int sum1,int sum2) { //number:1,sum1:n[0],sum2:n[2]
		if (number==1) {
			String t = pattern5(3,s+"+",sum1+n[1],sum2);
			if (!t.equals("f")) return t;
			t = pattern5(3,s+"-",sum1-n[1],sum2);
			if (!t.equals("f")) return t;
			t = pattern5(3,s+"*",sum1*n[1],sum2);
			if (!t.equals("f")) return t;
		} else if (number==3) {
			String t = pattern5(2,s+"+",sum1,sum2+n[3]);
			if (!t.equals("f")) return t;
			t = pattern5(2,s+"-",sum1,sum2-n[3]);
			if (!t.equals("f")) return t;
			t = pattern5(2,s+"*",sum1,sum2*n[3]);
			if (!t.equals("f")) return t;
		} else if (number==2) {
			String t = pattern5(-1,s+"+",sum1+sum2,0);
			if (!t.equals("f")) return t;
			t = pattern5(-1,s+"-",sum1-sum2,0);
			if (!t.equals("f")) return t;
			t = pattern5(-1,s+"*",sum1*sum2,0);
			if (!t.equals("f")) return t;
		} else if (number==-1) {
			if (sum1==10) return "(("+n[0]+" "+s.charAt(0)+" "+n[1]+") "+s.charAt(2)+" ("+n[2]+" "+s.charAt(1)+" "+n[3]+"))";
			else return "f";
		}
		return "f";
	}
}

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			while ("0 0 0 0".equals(buf = br.readLine())==false) {
				StringTokenizer st = new StringTokenizer(buf);
				int n[] = new int[4];
				for (int i=0;i<4;i++) n[i] = Integer.parseInt(st.nextToken());
				
				boolean end = false;
				for (int i=0;i<4;i++) {
					for (int j=0;j<4;j++) {
						if (j==i) continue;
						for (int k=0;k<4;k++) {
							if (k==j||k==i) continue;
							for (int l=0;l<4;l++) {
								if (l==i||l==j||l==k) continue;
								Researcher r = new Researcher(n,i,j,k,l);
								String t = r.FindPattern();
								if (t.equals("f")==false) {
									System.out.println(t);
									end = true;
									break;
								}
							}
							if (end) break;
						}
						if (end) break;
					}
					if (end) break;
				}
				if (end==false) System.out.println(0);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}