[step:Apply the nonnegative identity to the positive and negative parts of $h$]
Define the positive and negative parts $h^+:S\to[0,\infty)$ and $h^-:S\to[0,\infty)$ by
\begin{align*}
h^+(x)=\max\{h(x),0\},\qquad h^-(x)=\max\{-h(x),0\}.
\end{align*}
Then $h=h^+-h^-$ and $|h|=h^++h^-$. Since $h\in L^1(S,\mathcal S,\mathbb P)$,
\begin{align*}
\int_S h^+\,d\mathbb P(x)<\infty,\qquad \int_S h^-\,d\mathbb P(x)<\infty.
\end{align*}
Applying the nonnegative case to $h^+$ and $h^-$ gives
\begin{align*}
\int_S h^+L\,d\mathbb Q(x)=\int_S h^+\,d\mathbb P(x)<\infty.
\end{align*}
Similarly,
\begin{align*}
\int_S h^-L\,d\mathbb Q(x)=\int_S h^-\,d\mathbb P(x)<\infty.
\end{align*}
Therefore
\begin{align*}
\int_S |h|L\,d\mathbb Q(x)=\int_S h^+L\,d\mathbb Q(x)+\int_S h^-L\,d\mathbb Q(x)<\infty.
\end{align*}
Hence $hL\in L^1(S,\mathcal S,\mathbb Q)$. Since $hL=h^+L-h^-L$ $\mathbb Q$-a.e., subtracting the two finite identities gives
\begin{align*}
\int_S hL\,d\mathbb Q(x)=\int_S h^+L\,d\mathbb Q(x)-\int_S h^-L\,d\mathbb Q(x)=\int_S h^+\,d\mathbb P(x)-\int_S h^-\,d\mathbb P(x)=\int_S h\,d\mathbb P(x).
\end{align*}
This is the desired importance sampling identity.
[/step]