#include <iostream>
#include <string>
using namespace std;

#define SAFE_DELETE( x ) { if ( x ){ delete x; x = NULL; } }

struct tCell{
	tCell() : prev( NULL ), next( NULL ){}
	string s;
	tCell *prev, *next;
};

class MyArray{
public:
	MyArray() : mSize( 0 ), head( NULL ), tail( NULL ){
		head = new tCell;
		tail = new tCell;
		head->next = tail;
		tail->prev = head;
	}
	~MyArray(){
		init();
		SAFE_DELETE( tail );
		SAFE_DELETE( head );
	}

	void init(){
		for ( int i = mSize; i > 0; --i ){
			tCell* cell = tail->prev;
			cell->prev->next = cell->next;
			cell->next->prev = cell->prev;
			SAFE_DELETE( cell );
		}
		mSize = 0;
	}
	void pushBack( string s ){
		++mSize;
		tCell* cell = new tCell;
		cell->s = s;
		cell->prev = tail->prev;
		cell->next = tail;
		cell->prev->next = cell;
		cell->next->prev = cell;
	}
	tCell* erase( tCell* cell ){
		--mSize;
		tCell* rcell = cell->next;
		cell->prev->next = cell->next;
		cell->next->prev = cell->prev;
		SAFE_DELETE( cell );
		return rcell;
	}
	void unique(){
		tCell* cellA = head->next;
		while ( cellA->next ){
			string s = cellA->s;
			tCell* cellB = cellA->next;
			while ( cellB->next ){
				if ( s == cellB->s ){
					cellB = erase( cellB );
				}else{
					cellB = cellB->next;
				}
			}
			cellA = cellA->next;
		}
	}
	int size(){
		return mSize;
	}
	string operator[]( int n ){
		tCell* cell = head->next;
		for ( int i = 0; i < n; ++i ){
			cell = cell->next;
		}
		return cell->s;
	}

private:
	int mSize;
	tCell *head, *tail;
};

void combiFig( MyArray* a, string is, string os ){
	for ( unsigned i = 0; i < is.size(); ++i ){
		string iss = is;
		string oss = os;
		oss += iss[ i ];
		iss.erase( i , 1 );
		if ( !iss.size() ){
			a->pushBack( oss );
		}else{
			combiFig( a, iss, oss );
		}
	}
}

void createFigList( MyArray* a, int* n ){
	string is, os;
	for ( int i = 0; i < 4; ++i ){
		is += static_cast< char >( n[ i ] + '0' );
	}
	combiFig( a, is, os );
}

void combiSign( MyArray* a, string is ){
	for ( int i = 0; i < 3; ++i ){
		string s = is;
		switch ( i ){
			case 0:
				s += '+';
				break;
			case 1:
				s += '-';
				break;
			case 2:
				s += '*';
				break;
		}
		if ( s.size() == 3 ){
			a->pushBack( s );
		}else{
			combiSign( a, s );
		}
	}
}

void createSignList( MyArray* a ){
	string s;
	combiSign( a, s );
}

int calc( int a, int b, char c ){
	switch ( c ){
		case '+':
			return a + b;
		case '-':
			return a - b;
		case '*':
			return a * b;
	}
	return 0;
}

int main(){
	int n[ 4 ];
	MyArray* figList = new MyArray;
	MyArray* signList = new MyArray;

	while ( cin >> n[ 0 ] >> n[ 1 ] >> n[ 2 ] >> n[ 3 ] ){
		figList->init();
		signList->init();
		if ( !n[ 0 ] && !n[ 1 ] && !n[ 2 ] && !n[ 3 ] ) break;

		createFigList( figList, n );
		figList->unique();
		createSignList( signList );

		bool dicision = false;
		string result = "";

		for ( int i = 0; i < figList->size(); ++i ){
			string figure = (*figList)[ i ];
			int a, b, c, d;
			a = static_cast< int >( figure[ 0 ] - '0' );
			b = static_cast< int >( figure[ 1 ] - '0' );
			c = static_cast< int >( figure[ 2 ] - '0' );
			d = static_cast< int >( figure[ 3 ] - '0' );
			for ( int j = 0; j < signList->size(); ++j ){
				string sign = (*signList)[ j ];
				for ( int k = 0; k < 5; ++k ){
					int x = 0, y = 0;
					switch ( k ){
						case 0:
							x = calc( a, b, sign[ 0 ] );
							x = calc( x, c, sign[ 1 ] );
							x = calc( x, d, sign[ 2 ] );
							if ( x == 10 ){
								result = result.erase() + "(((" + figure[ 0 ] + " " + sign[ 0 ] + " " + figure[ 1 ] + ") " + sign[ 1 ] + " " + figure[ 2 ] + ") " + sign[ 2 ] + " " + figure[ 3 ] + ")";
								dicision = true;
							}
							break;
						case 1:
							x = calc( a, b, sign[ 0 ] );
							y = calc( c, d, sign[ 2 ] );
							x = calc( x, y, sign[ 1 ] );
							if ( x == 10 ){
								result = result.erase() + "((" + figure[ 0 ] + " " + sign[ 0 ] + " " + figure[ 1 ] + ") " + sign[ 1 ] + " (" + figure[ 2 ] + " " + sign[ 2 ] + " " + figure[ 3 ] + "))";
								dicision = true;
							}
							break;
						case 2:
							x = calc( b, c, sign[ 1 ] );
							x = calc( a, x, sign[ 0 ] );
							x = calc( x, d, sign[ 2 ] );
							if ( x == 10 ){
								result = result.erase() + "((" + figure[ 0 ] + " " + sign[ 0 ] + " (" + figure[ 1 ] + " " + sign[ 1 ] + " " + figure[ 2 ] + ")) " + sign[ 2 ] + " " + figure[ 3 ] + ")";
								dicision = true;
							}
							break;
						case 3:
							x = calc( b, c, sign[ 1 ] );
							x = calc( x, d, sign[ 2 ] );
							x = calc( a, x, sign[ 0 ] );
							if ( x == 10 ){
								result = result.erase() + "(" + figure[ 0 ] + " " + sign[ 0 ] + " ((" + figure[ 1 ] + " " + sign[ 1 ] + " " + figure[ 2 ] + ") " + sign[ 2 ] + " " + figure[ 3 ] + "))";
								dicision = true;
							}
							break;
						case 4:
							x = calc( c, d, sign[ 2 ] );
							x = calc( b, x, sign[ 1 ] );
							x = calc( a, x, sign[ 0 ] );
							if ( x == 10 ){
								result = result.erase() + "(" + figure[ 0 ] + " " + sign[ 0 ] + " (" + figure[ 1 ] + " " + sign[ 1 ] + " (" + figure[ 2 ] + " " + sign[ 2 ] + " " + figure[ 3 ] + ")))";
								dicision = true;
							}
							break;
					}
					if ( dicision ) break;
				}
				if ( dicision ) break;
			}
			if ( dicision ) break;
		}

		if ( !result.size() ) result = "0";
		cout << result << endl;

	}

	delete signList;
	delete figList;
	return 0;
}

Measured memory_bytes: 0