def solve(ary)
  if ary.size <= 1
    return ary[0] if eval(ary[0]) == 10
  else
    idxs = [*0...ary.size]
    idxs.combination(2) do |i, j|
      a, b = ary[i], ary[j]
      nxt = (idxs - [i, j]).map{|x| ary[x]}
      ["(#{a} + #{b})", "(#{a} - #{b})", "(#{b} - #{a})", "#{a} * #{b}"].each do |st|
        result = solve(nxt + [st])
        return result if result
      end
    end
  end
  nil
end

until (given = $<.gets.chomp.split) == ["0", "0", "0", "0"]
  ans = solve(given)
  puts ans ? ans : 0
end
