q = (%w{+ - *}*3).combination(3).to_a
w = %w{
  (%d%s%d)%s(%d%s%d)
  %d%s((%d%s%d)%s%d)
  %d%s(%d%s(%d%s%d))
  ((%d%s%d)%s%d)%s%d
  (%d%s(%d%s%d))%s%d
}
while"0 0 0 0\n"!=s=gets
  f = nil
  s.split.permutation.map{|a,b,c,d|
    q.map{|x,y,z|
      w.map{|e|
        e = e%[a,x,b,y,c,z,d]
        if eval(e) == 10
          f = 1
          puts e
          break
        end
      }
      break if f
    }
    break if f
  }
  p 0 if !f
end