#include<stdio.h>

#define          NUM  4
#define       IN_MAX  4 
#define      ANS_CAL 13 /*出力する配列の最大数（かっこありの式）*/
#define NOT_BRACKETS  7 /*かっこなし*/
#define      ANS_TEN 10

enum{
	NOT_CASE,  /*10になりません 0*/
	CASE1,	   /*(((a b) c) d)  1*/
	CASE2,     /*((a b) (c d))  2*/
	PLUS = 100, /* + */
	MINUS,    /* - */
	TIMES      /* * */
};

int ans_case1(int *cal);
int ans_case2(int *cal);
int   add(int l, int r);
int   sub(int l, int r);
int multi(int l, int r);
void output(char *ans, int *cal, int flag);

int main(void)
{
	char ans[ ANS_CAL ];
	int i = 0, j = 0, k = 0;
	int in[NUM] = {0, 0, 0, 0};
	int cal[NOT_BRACKETS];
	int flag = NOT_CASE;
	int a = 0, b = 0, c = 0, d = 0;

	while(scanf("%d %d %d %d", &in[0], &in[1], &in[2], &in[3]) != EOF)
	{
		if(in[0] == 0&& in[1] == 0 && in[2] == 0 && in[3] == 0)
		{
			break;
		}
		
		for(a = 0; a < IN_MAX; a++)
		{	
			for(b = 0; b < IN_MAX; b++)
			{
				for(c = 0; c < IN_MAX; c++)
				{
					for(d = 0; d < IN_MAX; d++)
					{
						if(a != b && a != c && a != d
						&& b != c && b != d
						&& c != d)
						{
							for(i = PLUS; i <= TIMES; i++)
							{
								for(j = PLUS; j <= TIMES; j++)
								{
									for(k = PLUS; k <= TIMES; k++)
									{
										cal[0] = in[a];
										cal[1] = i; 
										cal[2] = in[b];
										cal[3] = j;
										cal[4] = in[c];
										cal[5] = k;
										cal[6] = in[d];
										flag = ans_case1( cal );
										if(flag != NOT_CASE)
										{
											break;
										}
										
										flag = ans_case2( cal );
										if(flag != NOT_CASE)
										{
											break;
										}
									}
									if(flag != NOT_CASE)
									{
										break;
									}
								}
								if(flag != NOT_CASE)
								{
									break;
								}
							}
							if(flag != NOT_CASE)
							{
								break;
							}
						}
						if(flag != NOT_CASE)
						{
							break;
						}
					}
					if(flag != NOT_CASE)
					{
						break;
					}
				}
				if(flag != NOT_CASE)
				{
					break;
				}
			}
			if(flag != NOT_CASE)
			{
				break;
			}
		}
		/*printf("flag====%d",flag);*/
		output(ans, cal , flag);
		flag = NOT_CASE;
		
	}
	return 0;
}
int ans_case1(int *cal)
{
	int ans = 0;
	int i = 0;

	ans = cal[0];
	for(i = 1;i < NOT_BRACKETS; i += 2 )
	{
		if(cal[i] == PLUS)
		{
			ans = add(ans , cal[i + 1]);
		}
		else if(cal[i] == MINUS)
		{
			ans = sub(ans , cal[i + 1]);
		}
		else if(cal[i] == TIMES)
		{
			ans = multi(ans , cal[i + 1]);
		}
	}
	if(ans == ANS_TEN)
	{
		return CASE1;
	}
	else
	{
		return NOT_CASE;
	}
}
int ans_case2(int *cal)
{
	int lr[2] ={0, 0};/*abでの計算結果とcdでの計算結果を*/
	int i = 0,j = 0;/*abの計算= 0 とcdの計算= 1*/
	int ans=0;

	for(i = 1; i < NOT_BRACKETS; i += 4)/*abの計算とcdの計算の二回まわる*/
	{
		if(cal[i] == PLUS)
		{
			lr[j] = add(cal[i - 1] , cal[i + 1]);
		}
		else if(cal[i] == MINUS)
		{
			lr[j] = sub(cal[i - 1] , cal[i + 1]);
		}
		else if(cal[i] == TIMES)
		{
			lr[j] = multi(cal[i - 1] , cal[i + 1]);
		}
		j++;
	}

	if(cal[ 3 ] == PLUS)
	{
		ans = add(lr[0], lr[1]);
	}
	else if(cal[3] == MINUS)
	{
		ans = sub(lr[0], lr[1]);
	}
	else if(cal[3] == TIMES)
	{
		ans = multi(lr[0], lr[1]);
	}

	if(ans == ANS_TEN)
	{
		return CASE2;
	}
	else
	{
		return NOT_CASE;
	}
}

/*ーーーーーーーーー足し算ーーーーーーーーーーーーーーー*/
int add(int l, int r)
{
	return (l + r);
}

/*ーーーーーーーーー引き算ーーーーーーーーーーーーーーー*/
int sub(int l, int r)
{
	return (l - r);
}
/*ーーーーーーーーー掛け算ーーーーーーーーーーーーーーー*/
int multi(int l, int r)
{
	return (l * r);
}
void output(char *ans, int *cal, int flag)
{
	int i = 0;
	int j = 6;
	int c = 4;
	int a = 3;

	if(flag == CASE1)
	{
		for(i = 0; i < 3 ; i++)
		{
			ans[i] = '(';
			ans[j] = ')';
			j += 3;
		}
		for(i = 1; i < NOT_BRACKETS; i += 2)
		{
			if(cal[i] == PLUS)
			{
				ans[c] = '+';
			}
			else if(cal[i] == MINUS)
			{
				ans[c] = '-';
			}
			else if(cal[i] == TIMES)
			{
				ans[c] = '*';
			}
			c += 3;	
		}
		ans[  3 ] = 0x30 + cal[ 0 ];
		ans[  5 ] = 0x30 + cal[ 2 ];
		ans[  8 ] = 0x30 + cal[ 4 ];
		ans[ 11 ] = 0x30 + cal[ 6 ];
		
		for(i = 0;i < ANS_CAL ;i++)
		{
			printf("%c", ans[ i ]);
		}
		printf("\n");
	}
	else if(flag == CASE2)
	{
			ans[  0 ] = '(';
			ans[  1 ] = '(';
			ans[  7 ] = '(';
			ans[  5 ] = ')';
			ans[ 11 ] = ')';
			ans[ 12 ] = ')';
		for(i = 1; i < NOT_BRACKETS; i += 2)
		{
			if(cal[i] == PLUS)
			{
				ans[a] = '+';
			}
			else if(cal[i] == MINUS)
			{
				ans[a] = '-';
			}
			else if(cal[i] == TIMES)
			{
				ans[a] = '*';
			}
			a += 3;	
		}
		ans[  2 ] = 0x30 + cal[ 0 ];
		ans[  4 ] = 0x30 + cal[ 2 ];
		ans[  8 ] = 0x30 + cal[ 4 ];
		ans[ 10 ] = 0x30 + cal[ 6 ];
		
		for(i = 0;i < ANS_CAL ;i++)
		{
			printf("%c", ans[ i ]);
		}
		printf("\n");
	}
	else if(flag == NOT_CASE)	
	{
		printf("0\n");
	}

}

Measured memory_bytes: 588