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|
      ["((#{a} #{e} #{b}) #{f}( #{c} #{g} #{d}))",
       "(( #{a} #{e}( #{b} #{f} #{c})) #{g} #{d})", 
       "( #{a} #{e}(( #{b} #{f} #{c}) #{g} #{d}))",
       "((( #{a} #{e} #{b}) #{f} #{c}) #{g} #{d})", 
       "( #{a} #{e}( #{b} #{f}( #{c} #{g} #{d})))"].each do |form|
        if eval(form) == 10
          puts form
          return true
        end
      end
    end
  end
  false
end
loop do
  num = gets.split
  break if num[0] == "0"
  p 0 unless solve(num)
end