readlines.each do |l|
  n = l.split.map(&:to_i)
  break if n.all?{|i| i==0}
  catch :solve do
    n.permutation do |a|
      [0,1,2].product([0,1], [0]).each do |arr|
        expr = a.dup
        arr.each do |i|
          expr[i,2] = "("+expr[i,2].join(" %c ")+")"
        end
        ope = %w(+ - *)
        ope.product(ope, ope).each do |opes|
          e = expr.first % opes
          if eval(e)==10
            puts e
            throw :solve
          end
        end
      end
    end
    puts 0
  end
end