Form = ["((aeb)f(cgd))", "((ae(bfc))gd)", "(ae((bfc)gd))", "(((aeb)fc)gd)", "(ae(bf(cgd)))"]
Exp = ["+", "-", "*"]
def solve(num)
  num.permutation(4).to_a.each do |a, b, c, d| 
    Exp.repeated_permutation(3).to_a.each do |e, f, g|
      h = {}
      [a,b,c,d,e,f,g].zip(("a".."g").to_a).each{|i, j| h[j] = i }
      Form.each do |form|
        if eval(ret = form.gsub(/a|b|c|d|e|f|g/, h)) == 10
          puts ret
          return true
        end
      end
    end
  end
  false
end
loop do
  num = gets.split
  break if num[0] == "0"
  p 0 unless solve(num)
end