op = "+-*"
k = (0..63).to_a

op = (op*3).split("").combination(3).to_a
op = op.map{|x| x.join}.uniq
k = k.map{|x| x.to_s(2)}
k = k.map{|x| "0"*(6-x.length) + x}
ka = ("()   ").split("").permutation(5).to_a
ka = ka.map{|x|  x = x.join if("()" == x.join.split.join)}.uniq.compact
ka = ka.find_all {|i| !i.include?("()")}
begin
ans = 0
loop{
	a = gets
	b = a.split(' ')
	p b
	c = 0
	4.times{|i| c+= b[i].to_i}
	break if(c==0)
	b = b.permutation(4).to_a
	b = b.map{|x| x.join}.uniq
		
	op.size.times{|i|
		k.size.times{|j|
			b.size.times{|k|
				com = "ans= "
				coms = 0;
				8.times{ |l|
					if(l%2==0)
						com+=ka[i] if(k[j][coms] == '1' && ka[j][coms] == ')')
						if(coms>0 && coms<4)
							com+=op[i][coms-1]
						end
						com+=ka[i] if(k[j][coms] == '1' && ka[j][coms]==')')
						coms+=1;
					else
						com += b[k][l/2];
					end
				}
				eval (com)
				if(ans == 10)
					puts com.split[-1]
					raise
				end
			}
		}
	}
}
rescue
end
puts "0" if(ans==0)