ops = ["+", "-", "*", "/"]

def calc a, op, b
  case op
  when "+"
    a + b
  when "-"
    a - b
  when "*"
    a * b
  when "/"
    if b == 0
      10000000
    else
      a / b
    end
  end
end

loop do
  input = gets.split.map{|v| v.to_i}
  if input == [0, 0, 0, 0]
    exit
  end

  f = false
  input.permutation do |a|
    for i in 0 .. 3 do
      for j in 0 .. 3 do
        for k in 0 .. 3 do
          if calc(calc(calc(a[0], ops[i], a[1]), ops[j], a[2]), ops[k], a[3]) == 10
            puts ("(%d " + ops[i] + " %d) " + ops[j] + " (%d " + ops[k] + " %d)") % a
            f = true
            break
          end
          if calc(calc(a[0], ops[i], a[1]), ops[j], calc(a[2], ops[k], a[3])) == 10
            puts ("((%d " + ops[i] + " %d) " + ops[j] + " %d) " + ops[k] + " %d") % a
            f = true
            break
          end
        end
        break if f
      end
      break if f
    end
    break if f
  end
  puts 0 unless f
end