// Aizu Vol-0 0041: Expression
// 2017.8.5

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

char *gets(char *);
char buf[100], *p;

int getInt(void)
{
	while (isspace(*p)) p++;
	return *p++ - '0';
}

int ord1[6] = { 2, 1, 1, 0, 0, 0 }, ord2[6] = { 3, 3, 2, 3, 2, 1 };
int a[4];
signed char Q[10], R[10];
#define BASE 10
char T[100];
#define MUL 1
#define PLS 2
#define MIS 3
#define MSS 4

int log(int i, int j, int op)
{
	return (i << 4) | (op << 2) | j;
}

int fact(int x)
{
	if (x < 0) x = -x;
	return x == 1 || x == 2 || x == 5 || x == 10;
}

int lookup(int x)
{
	if (-8 <= x && x <= 81 && T[x + BASE]) return T[x + BASE];
	return 0;
}

char getOp(int a)
{
	if (a == MUL) return '*';
	if (a == PLS) return '+';
	return '-';
}

void disp(int r, int op, int i2, int op1, int i3)
{
	int i0, i1, op0;
	i0 = (r >> 4) & 3, i1 = r & 3, op0 = (r >> 2) & 3;
	if (op == MSS) {
		printf("(%d %c %d) - (%d %c %d)\n", a[i2], getOp(op1), a[i3], a[i0], getOp(op0), a[i1]);
	}
	else {
		printf("(%d %c %d) %c (%d %c %d)\n", a[i0], getOp(op0), a[i1], getOp(op), a[i2], getOp(op1), a[i3]);
	}
}

void disp2(int r, int op1, int i2, int op2, int i3)
{
	int i0, i1, op0;
	i0 = (r >> 4) & 3, i1 = r & 3, op0 = (r >> 2) & 3;
	if (op2 == MSS) {
		if (op1 == MSS)
			printf("%d - (%d - (%d %c %d))\n", a[i3], a[i2], a[i0], getOp(op0), a[i1]);
		else
			printf("%d - ((%d %c %d) %c %d)\n", a[i3], a[i0], getOp(op0), a[i1], getOp(op1), a[i2]);
	}
	else {
		if (op1 == MSS)
			printf("(%d - (%d %c %d)) %c %d\n", a[i2], a[i0], getOp(op0), a[i1], getOp(op2), a[i3]);
		else
			printf("((%d %c %d) %c %d) %c %d\n", a[i0], getOp(op0), a[i1], getOp(op1), a[i2], getOp(op2), a[i3]);
	}
}

int check(int i, int op, int j, int x)
{
	int r;
	if (fact(x) && (r = lookup(10 / x))) { disp(r, MUL, i, op, j); return 1; }
	if ((r = lookup(10 - x))) { disp(r, PLS, i, op, j); return 1; }
	if ((r = lookup(10 + x))) { disp(r, MIS, i, op, j); return 1; }
	if ((r = lookup(x - 10))) { disp(r, MSS, i, op, j); return 1; }
	return 0;
}

int check3(int r, int op1, int i2, int i3, int x)
{
	int a3 = a[i3];
	//	printf("Check 3 --> op1 %d, i2 %d, i3 %d, a3 %d, x %d\n", op1, i2, i3, a3, x);
	if (fact(x) && x * a3 == 10) { disp2(r, op1, i2, MUL, i3); return 1; }
	if (x + a3 == 10) { disp2(r, op1, i2, PLS, i3); return 1; }
	if (x - a3 == 10) { disp2(r, op1, i2, MIS, i3); return 1; }
	if (a3 - x == 10) { disp2(r, op1, i2, MSS, i3); return 1; }
	return 0;
}

int check2(int i2, int i3)
{
	int i, a2 = a[i2];
	for (i = 0; i < 4; i++) {
		if (check3(R[i], MUL, i2, i3, Q[i] * a2)) return 1;
		if (check3(R[i], PLS, i2, i3, Q[i] + a2)) return 1;
		if (check3(R[i], MIS, i2, i3, Q[i] - a2)) return 1;
		if (check3(R[i], MSS, i2, i3, a2 - Q[i])) return 1;
	}
	return 0;
}

int main()
{
	int i, j, k, i2, i3;

	while (1) {
		gets(p = buf);
		for (i = 0; i < 4; i++) a[i] = getInt();
		if (!a[0]) break;

		for (i = 1; i < 4; i++) {
			memset(T, 0, sizeof(T));
			Q[0] = a[0] * a[i], R[0] = log(0, i, MUL), T[Q[0] + BASE] = R[0];
			Q[1] = a[0] + a[i], R[1] = log(0, i, PLS), T[Q[1] + BASE] = R[1];
			Q[2] = a[0] - a[i], R[2] = log(0, i, MIS), T[Q[2] + BASE] = R[2];
			Q[3] = a[i] - a[0], R[3] = log(i, 0, MIS), T[Q[3] + BASE] = R[3];

			j = ord1[i - 1], k = ord2[i - 1];
			if (check(j, MUL, k, a[j] * a[k])) goto DONE;
			if (check(j, PLS, k, a[j] + a[k])) goto DONE;
			if (check(j, MIS, k, a[j] - a[k])) goto DONE;
			if (check(k, MIS, j, a[k] - a[j])) goto DONE;
		}
		for (i = k = 0; i < 4; i++) {
			for (j = i + 1; j < 4; j++) {
				Q[0] = a[i] * a[j], R[0] = log(i, j, MUL);
				Q[1] = a[i] + a[j], R[1] = log(i, j, PLS);
				Q[2] = a[i] - a[j], R[2] = log(i, j, MIS);
				Q[3] = a[j] - a[i], R[3] = log(j, i, MSS);
				i2 = ord1[k], i3 = ord2[k], k++;
				if (check2(i2, i3)) goto DONE;
				if (a[i2] != a[i3] && check2(i3, i2)) goto DONE;
			}
		}
		puts("0");
		continue;
	DONE:;
	}
	return 0;
}

Measured memory_bytes: 528