#include<iostream>
#include<string>
#include<sstream>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 10000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
typedef pair<P, int> PI;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

bool used[4];
int a[4], v[4], e[3];

int tp[5][7] = {
  {0, 0, 1, 0, 0, 1, 1},
  {0, 0, 0, 1, 0, 1, 1},
  {0, 0, 0, 0, 1, 1, 1},
  {0, 0, 1, 0, 1, 0, 1},
  {0, 0, 0, 1, 1, 0, 1}
};

bool calc() {
  rep(i, 5) {
    stack<int> sta;
    int cv = 0, ce = 0;
    rep(j, 7) {
      if(tp[i][j]) {
        int e2 = sta.top(); sta.pop();
        int e1 = sta.top(); sta.pop();
        int r;
        switch(e[ce++]) {
          case 0: r = e1 + e2; break;
          case 1: r = e1 - e2; break;
          case 2: r = e1 * e2; break;
        }
        sta.push(r);
      }else {
        sta.push(v[cv++]);
      }
    }
    if(sta.top()==10) {
      stack<string> sts;
      string s;
      cv = ce = 0;
      rep(j, 7) {
        if(tp[i][j]) {
          string s2 = sts.top(); sts.pop();
          string s1 = sts.top(); sts.pop();
          string r;
          switch(e[ce++]) {
            case 0: r = s1 + "+" + s2; break;
            case 1: r = s1 + "-" + s2; break;
            case 2: r = s1 + "*" + s2; break;
          }
          r = "(" + r + ")";
          sts.push(r);
        }else {
          stringstream ss;
          ss << v[cv++];
          sts.push(ss.str());
        }
      }
      cout << sts.top() << endl;
      return true;
    }
  }
  return false;
}

bool e_dfs(int c) {
  if(c==3) {
    return calc();
  }else {
    rep(i, 3) {
      e[c] = i;
      if(e_dfs(c+1)) return true;
    }
  }
  return false;
}

bool v_dfs(int c) {
  if(c==4) {
    return e_dfs(0);
  }else {
    rep(i, 4) {
      if(!used[i]) {
        used[i] = true;
        v[c] = a[i];
        bool r = v_dfs(c+1);
        used[i] = false;
        if(r) return true;
      }
    }
  }
  return false;
}

int main() {
  while(cin >> a[0] >> a[1] >> a[2] >> a[3] && a[0]) {
    if(!v_dfs(0)) cout << "0" << endl;
  }
  return 0;
}
### Prompt

Your task is to create a cpp solution to the following 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))

### Response

```cpp
#include<iostream>
#include<string>
#include<sstream>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 10000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
typedef pair<P, int> PI;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

bool used[4];
int a[4], v[4], e[3];

int tp[5][7] = {
  {0, 0, 1, 0, 0, 1, 1},
  {0, 0, 0, 1, 0, 1, 1},
  {0, 0, 0, 0, 1, 1, 1},
  {0, 0, 1, 0, 1, 0, 1},
  {0, 0, 0, 1, 1, 0, 1}
};

bool calc() {
  rep(i, 5) {
    stack<int> sta;
    int cv = 0, ce = 0;
    rep(j, 7) {
      if(tp[i][j]) {
        int e2 = sta.top(); sta.pop();
        int e1 = sta.top(); sta.pop();
        int r;
        switch(e[ce++]) {
          case 0: r = e1 + e2; break;
          case 1: r = e1 - e2; break;
          case 2: r = e1 * e2; break;
        }
        sta.push(r);
      }else {
        sta.push(v[cv++]);
      }
    }
    if(sta.top()==10) {
      stack<string> sts;
      string s;
      cv = ce = 0;
      rep(j, 7) {
        if(tp[i][j]) {
          string s2 = sts.top(); sts.pop();
          string s1 = sts.top(); sts.pop();
          string r;
          switch(e[ce++]) {
            case 0: r = s1 + "+" + s2; break;
            case 1: r = s1 + "-" + s2; break;
            case 2: r = s1 + "*" + s2; break;
          }
          r = "(" + r + ")";
          sts.push(r);
        }else {
          stringstream ss;
          ss << v[cv++];
          sts.push(ss.str());
        }
      }
      cout << sts.top() << endl;
      return true;
    }
  }
  return false;
}

bool e_dfs(int c) {
  if(c==3) {
    return calc();
  }else {
    rep(i, 3) {
      e[c] = i;
      if(e_dfs(c+1)) return true;
    }
  }
  return false;
}

bool v_dfs(int c) {
  if(c==4) {
    return e_dfs(0);
  }else {
    rep(i, 4) {
      if(!used[i]) {
        used[i] = true;
        v[c] = a[i];
        bool r = v_dfs(c+1);
        used[i] = false;
        if(r) return true;
      }
    }
  }
  return false;
}

int main() {
  while(cin >> a[0] >> a[1] >> a[2] >> a[3] && a[0]) {
    if(!v_dfs(0)) cout << "0" << endl;
  }
  return 0;
}
```