A new efficient formulation of the HLLEM Riemann solver for general conservative and non-conservative hyperbolic systems