Form = ["((ae1b)e2(ce3d))", "((ae1(be2c))e3d)", "(ae1((be2c)e3d))", "(((ae1b)e2c)e3d)", "(ae1(be2(ce3d)))"]
Exp = ["+", "-", "*"]
def solve(num)
  num.permutation(4).to_a.each do |p,q,r,s| 
    Exp.repeated_permutation(3).to_a.each do |ex1, ex2, ex3|
      Form.each do |form|
        f = form.dup
        f.gsub!("a", p); f.gsub!("b", q); f.gsub!("c", r); f.gsub!("d", s); f.gsub!("e1", ex1); f.gsub!("e2", ex2); f.gsub!("e3", ex3)
        if eval(f) == 10
          puts f
          return true
        end
      end
    end
  end
  false
end
loop do
  num = gets.split
  break if num[0] == "0"
  p 0 unless solve(num)
end