def rec i, j
  if j - i == 1
    [i]
  else
    rs = []
    for k in i + 1 ... j
      ts = rec k, j
      rec(i, k).each do |t|
        ts.each do |s|
          [:+, :-, :*].each do |op|
            rs << [op, t, s]
          end
        end
      end
    end
    rs
  end
end

def ev xs, t
  return xs[t] if t.is_a? Integer
  op, a, b = t
  case op
  when :+
    ev(xs, a) + ev(xs, b)
  when :-
    ev(xs, a) - ev(xs, b)
  when :*
    ev(xs, a) * ev(xs, b)
  end
end

def pp xs, t
  return xs[t].to_s if t.is_a? Integer
  op, a, b = t
  case op
  when :+
    "(#{pp xs, a} + #{pp xs, b})"
  when :-
    "(#{pp xs, a} - #{pp xs, b})"
  when :*
    "(#{pp xs, a} * #{pp xs, b})"
  end
end

trees = rec 0, 4

loop do
  xs = gets.split.map(&:to_i)
  break if xs.all?(&:zero?)
  tree, xs = xs.permutation do |xs|
    tree = trees.find {|t| ev(xs, t) == 10 }
    break [tree, xs] if tree
  end
  puts tree ? pp(xs, tree) : 0
end