#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#endif

#define ITER(c)         __typeof__((c).begin())
#define FOREACH(it, c)  for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)        __typeof__((c).rbegin())
#define RFOREACH(it, c) for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define REVREP(i, n)    for (int i = ((n)-1); i >= 0; --i)
#define FIND(c, n)      std::find((c).begin(), (c).end(), (n));
#define BSEARCH(c, n)   std::binary_search((c).begin(), (c).end(), (n))
#define LLPOW(p1,p2)    ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)      (sizeof(A)/sizeof((A)[0]))
#define MIN(p1,p2)      (((p1)<(p2))?(p1):(p2))
#define MAX(p1,p2)      (((p1)>(p2))?(p1):(p2))
#define CIN_NO_SYNC     do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)       fgets((p), sizeof(p), stdin)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n') *_q = 0; } while(0)

typedef long long ll;
typedef unsigned long long ull;

#ifdef _DEBUG
#define pf printf
#define pr(n) do { cout << #n " = " << (n) << endl; } while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#endif

int add(int p1, int p2){ return p1 + p2; }
int sub(int p1, int p2){ return p1 - p2; }
int mul(int p1, int p2){ return p1 * p2; }
int (*op[])(int, int) = { add, sub, mul, };
const char *opm[] = { "+", "-", "*", };

const int TARGET = 10;

bool t(int n, int *p, int *o){
    if(n >= 3){
        if(op[o[2]](op[o[1]](op[o[0]](p[0], p[1]), p[2]), p[3]) == TARGET){ // a b c d
            printf("((%d %s %d) %s %d) %s %d\n", p[0], opm[o[0]], p[1], opm[o[1]], p[2], opm[o[2]], p[3]);
            return true;
        }
        if(op[o[2]](op[o[0]](p[0], op[o[1]](p[1], p[2])), p[3]) == TARGET){ // a(b c)d
            printf("(%d %s (%d %s %d)) %s %d\n", p[0], opm[o[0]], p[1], opm[o[1]], p[2], opm[o[2]], p[3]);
            return true;
        }
        if(op[o[1]](op[o[0]](p[0], p[1]), op[o[2]](p[2], p[3])) == TARGET){ // a b(c d)
            printf("(%d %s %d) %s (%d %s %d)\n", p[0], opm[o[0]], p[1], opm[o[1]], p[2], opm[o[2]], p[3]);
            return true;
        }
        if(op[o[0]](p[0], op[o[2]](op[o[1]](p[1], p[2]), p[3])) == TARGET){ // a(b c d)
            printf("%d %s ((%d %s %d) %s %d)\n", p[0], opm[o[0]], p[1], opm[o[1]], p[2], opm[o[2]], p[3]);
            return true;
        }
        if(op[o[0]](p[0], op[o[1]](p[1], op[o[2]](p[2], p[3]))) == TARGET){ // a(b(c d))
            printf("%d %s (%d %s (%d %s %d))\n", p[0], opm[o[0]], p[1], opm[o[1]], p[2], opm[o[2]], p[3]);
            return true;
        }
        return false;
    }
    for(int i = 0; i < ESIZEOF(op); i++){
        o[n] = i;
        if(t(n+1, p, o)) return true;
    }
    return false;
}

int main(){
    string s;
    int p[4];   // 数値
    int o[3];   // 演算子
    while(getline(cin, s)){
        sscanf(s.c_str(), "%d%d%d%d", &p[0], &p[1], &p[2], &p[3]);
        int tt = 0;
        REP(i,4) tt += p[i];
        if(tt == 0) break;
        sort(p, p+4);
        bool f = false;
        do {
            if(t(0, p, o)){
                f = true;
                break;
            }
        } while(next_permutation(p, p+4));
        if(!f) puts("0");
    }

    return 0;
}

Measured memory_bytes: 1268